@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
189 lines • 8.26 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.BackupPlanAssociation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A Backup and DR BackupPlanAssociation.
*
* To get more information about BackupPlanAssociation, 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 Bpa
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const mySA = new gcp.serviceaccount.Account("mySA", {
* accountId: "my-custom",
* displayName: "Custom SA for VM Instance",
* });
* const myinstance = new gcp.compute.Instance("myinstance", {
* networkInterfaces: [{
* accessConfigs: [{}],
* network: "default",
* }],
* name: "test-instance",
* machineType: "n2-standard-2",
* zone: "us-central1-a",
* bootDisk: {
* initializeParams: {
* image: "debian-cloud/debian-11",
* labels: {
* my_label: "value",
* },
* },
* },
* scratchDisks: [{
* "interface": "NVME",
* }],
* serviceAccount: {
* email: mySA.email,
* scopes: ["cloud-platform"],
* },
* });
* const bv1 = new gcp.backupdisasterrecovery.BackupVault("bv1", {
* location: "us-central1",
* backupVaultId: "bv-bpa",
* backupMinimumEnforcedRetentionDuration: "100000s",
* forceDelete: true,
* });
* const bp1 = new gcp.backupdisasterrecovery.BackupPlan("bp1", {
* location: "us-central1",
* backupPlanId: "bp-bpa-test",
* resourceType: "compute.googleapis.com/Instance",
* backupVault: bv1.id,
* backupRules: [{
* ruleId: "rule-1",
* backupRetentionDays: 2,
* standardSchedule: {
* recurrenceType: "HOURLY",
* hourlyFrequency: 6,
* timeZone: "UTC",
* backupWindow: {
* startHourOfDay: 12,
* endHourOfDay: 18,
* },
* },
* }],
* });
* const my_backup_plan_association = new gcp.backupdisasterrecovery.BackupPlanAssociation("my-backup-plan-association", {
* location: "us-central1",
* resourceType: "compute.googleapis.com/Instance",
* backupPlanAssociationId: "my-bpa",
* resource: myinstance.id,
* backupPlan: bp1.name,
* });
* ```
*
* ## Import
*
* BackupPlanAssociation can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/backupPlanAssociations/{{backup_plan_association_id}}`
*
* * `{{project}}/{{location}}/{{backup_plan_association_id}}`
*
* * `{{location}}/{{backup_plan_association_id}}`
*
* When using the `pulumi import` command, BackupPlanAssociation can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:backupdisasterrecovery/backupPlanAssociation:BackupPlanAssociation default projects/{{project}}/locations/{{location}}/backupPlanAssociations/{{backup_plan_association_id}}
* ```
*
* ```sh
* $ pulumi import gcp:backupdisasterrecovery/backupPlanAssociation:BackupPlanAssociation default {{project}}/{{location}}/{{backup_plan_association_id}}
* ```
*
* ```sh
* $ pulumi import gcp:backupdisasterrecovery/backupPlanAssociation:BackupPlanAssociation default {{location}}/{{backup_plan_association_id}}
* ```
*/
class BackupPlanAssociation extends pulumi.CustomResource {
/**
* Get an existing BackupPlanAssociation 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 BackupPlanAssociation(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of BackupPlanAssociation. 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'] === BackupPlanAssociation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["backupPlan"] = state ? state.backupPlan : undefined;
resourceInputs["backupPlanAssociationId"] = state ? state.backupPlanAssociationId : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["dataSource"] = state ? state.dataSource : undefined;
resourceInputs["lastSuccessfulBackupConsistencyTime"] = state ? state.lastSuccessfulBackupConsistencyTime : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["resource"] = state ? state.resource : undefined;
resourceInputs["resourceType"] = state ? state.resourceType : undefined;
resourceInputs["rulesConfigInfos"] = state ? state.rulesConfigInfos : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.backupPlan === undefined) && !opts.urn) {
throw new Error("Missing required property 'backupPlan'");
}
if ((!args || args.backupPlanAssociationId === undefined) && !opts.urn) {
throw new Error("Missing required property 'backupPlanAssociationId'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if ((!args || args.resource === undefined) && !opts.urn) {
throw new Error("Missing required property 'resource'");
}
if ((!args || args.resourceType === undefined) && !opts.urn) {
throw new Error("Missing required property 'resourceType'");
}
resourceInputs["backupPlan"] = args ? args.backupPlan : undefined;
resourceInputs["backupPlanAssociationId"] = args ? args.backupPlanAssociationId : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["resource"] = args ? args.resource : undefined;
resourceInputs["resourceType"] = args ? args.resourceType : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["dataSource"] = undefined /*out*/;
resourceInputs["lastSuccessfulBackupConsistencyTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["rulesConfigInfos"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(BackupPlanAssociation.__pulumiType, name, resourceInputs, opts);
}
}
exports.BackupPlanAssociation = BackupPlanAssociation;
/** @internal */
BackupPlanAssociation.__pulumiType = 'gcp:backupdisasterrecovery/backupPlanAssociation:BackupPlanAssociation';
//# sourceMappingURL=backupPlanAssociation.js.map