import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * A backup schedule for a Cloud Spanner 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/spanner/docs/reference/rest/v1/projects.instances.databases.backupSchedules) * * How-to Guides * * [Official Documentation](https://cloud.google.com/spanner/docs/backup) * * > **Warning:** This resource creates a Spanner Backup Schedule on a project that already has * a Spanner 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 * * ### Spanner Backup Schedule Daily Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const main = new gcp.spanner.Instance("main", { * name: "instance-id", * config: "regional-europe-west1", * displayName: "main-instance", * numNodes: 1, * }); * const database = new gcp.spanner.Database("database", { * instance: main.name, * name: "database-id", * versionRetentionPeriod: "3d", * ddls: [ * "CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)", * "CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)", * ], * deletionProtection: true, * }); * const full_backup = new gcp.spanner.BackupSchedule("full-backup", { * instance: main.name, * database: database.name, * name: "backup-schedule-id", * retentionDuration: "31620000s", * spec: { * cronSpec: { * text: "0 12 * * *", * }, * }, * fullBackupSpec: {}, * encryptionConfig: { * encryptionType: "USE_DATABASE_ENCRYPTION", * }, * }); * ``` * ### Spanner Backup Schedule Daily Incremental * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const main = new gcp.spanner.Instance("main", { * name: "instance-id", * config: "regional-europe-west1", * displayName: "main-instance", * numNodes: 1, * edition: "ENTERPRISE", * }); * const database = new gcp.spanner.Database("database", { * instance: main.name, * name: "database-id", * versionRetentionPeriod: "3d", * ddls: [ * "CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)", * "CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)", * ], * deletionProtection: true, * }); * const incremental_backup = new gcp.spanner.BackupSchedule("incremental-backup", { * instance: main.name, * database: database.name, * name: "backup-schedule-id", * retentionDuration: "31620000s", * spec: { * cronSpec: { * text: "0 12 * * *", * }, * }, * incrementalBackupSpec: {}, * encryptionConfig: { * encryptionType: "GOOGLE_DEFAULT_ENCRYPTION", * }, * }); * ``` * * ## Import * * BackupSchedule can be imported using any of these accepted formats: * * * `projects/{{project}}/instances/{{instance}}/databases/{{database}}/backupSchedules/{{name}}` * * `{{project}}/{{instance}}/{{database}}/{{name}}` * * `{{instance}}/{{database}}/{{name}}` * * When using the `pulumi import` command, BackupSchedule can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:spanner/backupSchedule:BackupSchedule default projects/{{project}}/instances/{{instance}}/databases/{{database}}/backupSchedules/{{name}} * $ pulumi import gcp:spanner/backupSchedule:BackupSchedule default {{project}}/{{instance}}/{{database}}/{{name}} * $ pulumi import gcp:spanner/backupSchedule:BackupSchedule default {{instance}}/{{database}}/{{name}} * ``` */ export declare 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: string, id: pulumi.Input, state?: BackupScheduleState, opts?: pulumi.CustomResourceOptions): BackupSchedule; /** * 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: any): obj is BackupSchedule; /** * The database to create the backup schedule on. */ readonly database: pulumi.Output; /** * Configuration for the encryption of the backup schedule. * Structure is documented below. */ readonly encryptionConfig: pulumi.Output; /** * The schedule creates only full backups.. */ readonly fullBackupSpec: pulumi.Output; /** * The schedule creates incremental backup chains. */ readonly incrementalBackupSpec: pulumi.Output; /** * The instance to create the database on. */ readonly instance: pulumi.Output; /** * A unique identifier for the backup schedule, which cannot be changed after * the backup schedule is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9]. */ readonly name: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * At what relative time in the future, compared to its creation time, the backup should be deleted, e.g. keep backups for 7 days. * A duration in seconds with up to nine fractional digits, ending with 's'. Example: '3.5s'. * You can set this to a value up to 366 days. */ readonly retentionDuration: pulumi.Output; /** * Defines specifications of the backup schedule. * Structure is documented below. */ readonly spec: pulumi.Output; /** * Create a BackupSchedule 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: BackupScheduleArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering BackupSchedule resources. */ export interface BackupScheduleState { /** * The database to create the backup schedule on. */ database?: pulumi.Input; /** * Configuration for the encryption of the backup schedule. * Structure is documented below. */ encryptionConfig?: pulumi.Input; /** * The schedule creates only full backups.. */ fullBackupSpec?: pulumi.Input; /** * The schedule creates incremental backup chains. */ incrementalBackupSpec?: pulumi.Input; /** * The instance to create the database on. */ instance?: pulumi.Input; /** * A unique identifier for the backup schedule, which cannot be changed after * the backup schedule is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9]. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * At what relative time in the future, compared to its creation time, the backup should be deleted, e.g. keep backups for 7 days. * A duration in seconds with up to nine fractional digits, ending with 's'. Example: '3.5s'. * You can set this to a value up to 366 days. */ retentionDuration?: pulumi.Input; /** * Defines specifications of the backup schedule. * Structure is documented below. */ spec?: pulumi.Input; } /** * The set of arguments for constructing a BackupSchedule resource. */ export interface BackupScheduleArgs { /** * The database to create the backup schedule on. */ database: pulumi.Input; /** * Configuration for the encryption of the backup schedule. * Structure is documented below. */ encryptionConfig?: pulumi.Input; /** * The schedule creates only full backups.. */ fullBackupSpec?: pulumi.Input; /** * The schedule creates incremental backup chains. */ incrementalBackupSpec?: pulumi.Input; /** * The instance to create the database on. */ instance: pulumi.Input; /** * A unique identifier for the backup schedule, which cannot be changed after * the backup schedule is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9]. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * At what relative time in the future, compared to its creation time, the backup should be deleted, e.g. keep backups for 7 days. * A duration in seconds with up to nine fractional digits, ending with 's'. Example: '3.5s'. * You can set this to a value up to 366 days. */ retentionDuration: pulumi.Input; /** * Defines specifications of the backup schedule. * Structure is documented below. */ spec?: pulumi.Input; }