All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.firestore.kotlin.BackupScheduleArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.firestore.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.firestore.BackupScheduleArgs.builder
import com.pulumi.gcp.firestore.kotlin.inputs.BackupScheduleDailyRecurrenceArgs
import com.pulumi.gcp.firestore.kotlin.inputs.BackupScheduleDailyRecurrenceArgsBuilder
import com.pulumi.gcp.firestore.kotlin.inputs.BackupScheduleWeeklyRecurrenceArgs
import com.pulumi.gcp.firestore.kotlin.inputs.BackupScheduleWeeklyRecurrenceArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName

/**
 * 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: {},
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * database = gcp.firestore.Database("database",
 *     project="my-project-name",
 *     name="database-id",
 *     location_id="nam5",
 *     type="FIRESTORE_NATIVE",
 *     delete_protection_state="DELETE_PROTECTION_ENABLED",
 *     deletion_policy="DELETE")
 * daily_backup = gcp.firestore.BackupSchedule("daily-backup",
 *     project="my-project-name",
 *     database=database.name,
 *     retention="8467200s",
 *     daily_recurrence=gcp.firestore.BackupScheduleDailyRecurrenceArgs())
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var database = new Gcp.Firestore.Database("database", new()
 *     {
 *         Project = "my-project-name",
 *         Name = "database-id",
 *         LocationId = "nam5",
 *         Type = "FIRESTORE_NATIVE",
 *         DeleteProtectionState = "DELETE_PROTECTION_ENABLED",
 *         DeletionPolicy = "DELETE",
 *     });
 *     var daily_backup = new Gcp.Firestore.BackupSchedule("daily-backup", new()
 *     {
 *         Project = "my-project-name",
 *         Database = database.Name,
 *         Retention = "8467200s",
 *         DailyRecurrence = null,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firestore"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
 * 			Project:               pulumi.String("my-project-name"),
 * 			Name:                  pulumi.String("database-id"),
 * 			LocationId:            pulumi.String("nam5"),
 * 			Type:                  pulumi.String("FIRESTORE_NATIVE"),
 * 			DeleteProtectionState: pulumi.String("DELETE_PROTECTION_ENABLED"),
 * 			DeletionPolicy:        pulumi.String("DELETE"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = firestore.NewBackupSchedule(ctx, "daily-backup", &firestore.BackupScheduleArgs{
 * 			Project:         pulumi.String("my-project-name"),
 * 			Database:        database.Name,
 * 			Retention:       pulumi.String("8467200s"),
 * 			DailyRecurrence: nil,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.firestore.Database;
 * import com.pulumi.gcp.firestore.DatabaseArgs;
 * import com.pulumi.gcp.firestore.BackupSchedule;
 * import com.pulumi.gcp.firestore.BackupScheduleArgs;
 * import com.pulumi.gcp.firestore.inputs.BackupScheduleDailyRecurrenceArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var database = new Database("database", DatabaseArgs.builder()
 *             .project("my-project-name")
 *             .name("database-id")
 *             .locationId("nam5")
 *             .type("FIRESTORE_NATIVE")
 *             .deleteProtectionState("DELETE_PROTECTION_ENABLED")
 *             .deletionPolicy("DELETE")
 *             .build());
 *         var daily_backup = new BackupSchedule("daily-backup", BackupScheduleArgs.builder()
 *             .project("my-project-name")
 *             .database(database.name())
 *             .retention("8467200s")
 *             .dailyRecurrence()
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   database:
 *     type: gcp:firestore:Database
 *     properties:
 *       project: my-project-name
 *       name: database-id
 *       locationId: nam5
 *       type: FIRESTORE_NATIVE
 *       deleteProtectionState: DELETE_PROTECTION_ENABLED
 *       deletionPolicy: DELETE
 *   daily-backup:
 *     type: gcp:firestore:BackupSchedule
 *     properties:
 *       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",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * database = gcp.firestore.Database("database",
 *     project="my-project-name",
 *     name="database-id",
 *     location_id="nam5",
 *     type="FIRESTORE_NATIVE",
 *     delete_protection_state="DELETE_PROTECTION_ENABLED",
 *     deletion_policy="DELETE")
 * weekly_backup = gcp.firestore.BackupSchedule("weekly-backup",
 *     project="my-project-name",
 *     database=database.name,
 *     retention="8467200s",
 *     weekly_recurrence=gcp.firestore.BackupScheduleWeeklyRecurrenceArgs(
 *         day="SUNDAY",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var database = new Gcp.Firestore.Database("database", new()
 *     {
 *         Project = "my-project-name",
 *         Name = "database-id",
 *         LocationId = "nam5",
 *         Type = "FIRESTORE_NATIVE",
 *         DeleteProtectionState = "DELETE_PROTECTION_ENABLED",
 *         DeletionPolicy = "DELETE",
 *     });
 *     var weekly_backup = new Gcp.Firestore.BackupSchedule("weekly-backup", new()
 *     {
 *         Project = "my-project-name",
 *         Database = database.Name,
 *         Retention = "8467200s",
 *         WeeklyRecurrence = new Gcp.Firestore.Inputs.BackupScheduleWeeklyRecurrenceArgs
 *         {
 *             Day = "SUNDAY",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firestore"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
 * 			Project:               pulumi.String("my-project-name"),
 * 			Name:                  pulumi.String("database-id"),
 * 			LocationId:            pulumi.String("nam5"),
 * 			Type:                  pulumi.String("FIRESTORE_NATIVE"),
 * 			DeleteProtectionState: pulumi.String("DELETE_PROTECTION_ENABLED"),
 * 			DeletionPolicy:        pulumi.String("DELETE"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = firestore.NewBackupSchedule(ctx, "weekly-backup", &firestore.BackupScheduleArgs{
 * 			Project:   pulumi.String("my-project-name"),
 * 			Database:  database.Name,
 * 			Retention: pulumi.String("8467200s"),
 * 			WeeklyRecurrence: &firestore.BackupScheduleWeeklyRecurrenceArgs{
 * 				Day: pulumi.String("SUNDAY"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.firestore.Database;
 * import com.pulumi.gcp.firestore.DatabaseArgs;
 * import com.pulumi.gcp.firestore.BackupSchedule;
 * import com.pulumi.gcp.firestore.BackupScheduleArgs;
 * import com.pulumi.gcp.firestore.inputs.BackupScheduleWeeklyRecurrenceArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var database = new Database("database", DatabaseArgs.builder()
 *             .project("my-project-name")
 *             .name("database-id")
 *             .locationId("nam5")
 *             .type("FIRESTORE_NATIVE")
 *             .deleteProtectionState("DELETE_PROTECTION_ENABLED")
 *             .deletionPolicy("DELETE")
 *             .build());
 *         var weekly_backup = new BackupSchedule("weekly-backup", BackupScheduleArgs.builder()
 *             .project("my-project-name")
 *             .database(database.name())
 *             .retention("8467200s")
 *             .weeklyRecurrence(BackupScheduleWeeklyRecurrenceArgs.builder()
 *                 .day("SUNDAY")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   database:
 *     type: gcp:firestore:Database
 *     properties:
 *       project: my-project-name
 *       name: database-id
 *       locationId: nam5
 *       type: FIRESTORE_NATIVE
 *       deleteProtectionState: DELETE_PROTECTION_ENABLED
 *       deletionPolicy: DELETE
 *   weekly-backup:
 *     type: gcp:firestore:BackupSchedule
 *     properties:
 *       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}}
 * ```
 * @property dailyRecurrence For a schedule that runs daily.
 * @property database The Firestore database id. Defaults to `"(default)"`.
 * @property project The ID of the project in which the resource belongs.
 * If it is not provided, the provider project is used.
 * @property retention 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 14 weeks.
 * - - -
 * @property weeklyRecurrence For a schedule that runs weekly on a specific day.
 * Structure is documented below.
 */
public data class BackupScheduleArgs(
    public val dailyRecurrence: Output? = null,
    public val database: Output? = null,
    public val project: Output? = null,
    public val retention: Output? = null,
    public val weeklyRecurrence: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.firestore.BackupScheduleArgs =
        com.pulumi.gcp.firestore.BackupScheduleArgs.builder()
            .dailyRecurrence(dailyRecurrence?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .database(database?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .retention(retention?.applyValue({ args0 -> args0 }))
            .weeklyRecurrence(
                weeklyRecurrence?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            ).build()
}

/**
 * Builder for [BackupScheduleArgs].
 */
@PulumiTagMarker
public class BackupScheduleArgsBuilder internal constructor() {
    private var dailyRecurrence: Output? = null

    private var database: Output? = null

    private var project: Output? = null

    private var retention: Output? = null

    private var weeklyRecurrence: Output? = null

    /**
     * @param value For a schedule that runs daily.
     */
    @JvmName("tgwjbcifceqhjhuj")
    public suspend fun dailyRecurrence(`value`: Output) {
        this.dailyRecurrence = value
    }

    /**
     * @param value The Firestore database id. Defaults to `"(default)"`.
     */
    @JvmName("jlouindbrdydapvt")
    public suspend fun database(`value`: Output) {
        this.database = value
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("vjsqencqjvckgmps")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value 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 14 weeks.
     * - - -
     */
    @JvmName("ghqnccktrtbodeyu")
    public suspend fun retention(`value`: Output) {
        this.retention = value
    }

    /**
     * @param value For a schedule that runs weekly on a specific day.
     * Structure is documented below.
     */
    @JvmName("orvumvrhqkxbjvqe")
    public suspend fun weeklyRecurrence(`value`: Output) {
        this.weeklyRecurrence = value
    }

    /**
     * @param value For a schedule that runs daily.
     */
    @JvmName("xcukrfybvievlnag")
    public suspend fun dailyRecurrence(`value`: BackupScheduleDailyRecurrenceArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.dailyRecurrence = mapped
    }

    /**
     * @param argument For a schedule that runs daily.
     */
    @JvmName("dvovswoeeinpitjc")
    public suspend fun dailyRecurrence(argument: suspend BackupScheduleDailyRecurrenceArgsBuilder.() -> Unit) {
        val toBeMapped = BackupScheduleDailyRecurrenceArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.dailyRecurrence = mapped
    }

    /**
     * @param value The Firestore database id. Defaults to `"(default)"`.
     */
    @JvmName("cdacqasfhrevptxf")
    public suspend fun database(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.database = mapped
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("pkplfrvaurmtgccc")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value 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 14 weeks.
     * - - -
     */
    @JvmName("ihvxubnnlvvhtdvr")
    public suspend fun retention(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.retention = mapped
    }

    /**
     * @param value For a schedule that runs weekly on a specific day.
     * Structure is documented below.
     */
    @JvmName("xtffixohwhitejnc")
    public suspend fun weeklyRecurrence(`value`: BackupScheduleWeeklyRecurrenceArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.weeklyRecurrence = mapped
    }

    /**
     * @param argument For a schedule that runs weekly on a specific day.
     * Structure is documented below.
     */
    @JvmName("ebnmjtgjxdyhvhvo")
    public suspend fun weeklyRecurrence(argument: suspend BackupScheduleWeeklyRecurrenceArgsBuilder.() -> Unit) {
        val toBeMapped = BackupScheduleWeeklyRecurrenceArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.weeklyRecurrence = mapped
    }

    internal fun build(): BackupScheduleArgs = BackupScheduleArgs(
        dailyRecurrence = dailyRecurrence,
        database = database,
        project = project,
        retention = retention,
        weeklyRecurrence = weeklyRecurrence,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy