@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
149 lines • 5.94 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.BackupSchedule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A backup schedule for a Cloud Firestore Database.
* This resource is owned by the database it is backing up, and is deleted along with the database.
* The actual backups are not though.
*
* To get more information about BackupSchedule, see:
*
* * [API documentation](https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.backupSchedules)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/firestore/docs/backups)
*
* > **Warning:** This resource creates a Firestore Backup Schedule on a project that already has
* a Firestore database.
* This resource is owned by the database it is backing up, and is deleted along
* with the database. The actual backups are not though.
*
* ## Example Usage
*
* ### Firestore Backup Schedule Daily
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const database = new gcp.firestore.Database("database", {
* project: "my-project-name",
* name: "database-id",
* locationId: "nam5",
* type: "FIRESTORE_NATIVE",
* deleteProtectionState: "DELETE_PROTECTION_ENABLED",
* deletionPolicy: "DELETE",
* });
* const daily_backup = new gcp.firestore.BackupSchedule("daily-backup", {
* project: "my-project-name",
* database: database.name,
* retention: "8467200s",
* dailyRecurrence: {},
* });
* ```
* ### Firestore Backup Schedule Weekly
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const database = new gcp.firestore.Database("database", {
* project: "my-project-name",
* name: "database-id",
* locationId: "nam5",
* type: "FIRESTORE_NATIVE",
* deleteProtectionState: "DELETE_PROTECTION_ENABLED",
* deletionPolicy: "DELETE",
* });
* const weekly_backup = new gcp.firestore.BackupSchedule("weekly-backup", {
* project: "my-project-name",
* database: database.name,
* retention: "8467200s",
* weeklyRecurrence: {
* day: "SUNDAY",
* },
* });
* ```
*
* ## Import
*
* BackupSchedule can be imported using any of these accepted formats:
*
* * `projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}`
*
* * `{{project}}/{{database}}/{{name}}`
*
* * `{{database}}/{{name}}`
*
* When using the `pulumi import` command, BackupSchedule can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:firestore/backupSchedule:BackupSchedule default projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:firestore/backupSchedule:BackupSchedule default {{project}}/{{database}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:firestore/backupSchedule:BackupSchedule default {{database}}/{{name}}
* ```
*/
class BackupSchedule extends pulumi.CustomResource {
/**
* Get an existing BackupSchedule 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 BackupSchedule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of BackupSchedule. 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'] === BackupSchedule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["dailyRecurrence"] = state ? state.dailyRecurrence : undefined;
resourceInputs["database"] = state ? state.database : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["retention"] = state ? state.retention : undefined;
resourceInputs["weeklyRecurrence"] = state ? state.weeklyRecurrence : undefined;
}
else {
const args = argsOrState;
if ((!args || args.retention === undefined) && !opts.urn) {
throw new Error("Missing required property 'retention'");
}
resourceInputs["dailyRecurrence"] = args ? args.dailyRecurrence : undefined;
resourceInputs["database"] = args ? args.database : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["retention"] = args ? args.retention : undefined;
resourceInputs["weeklyRecurrence"] = args ? args.weeklyRecurrence : undefined;
resourceInputs["name"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(BackupSchedule.__pulumiType, name, resourceInputs, opts);
}
}
exports.BackupSchedule = BackupSchedule;
/** @internal */
BackupSchedule.__pulumiType = 'gcp:firestore/backupSchedule:BackupSchedule';
//# sourceMappingURL=backupSchedule.js.map