UNPKG

@pulumi/gcp

Version:

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

491 lines • 16.4 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"); /** * Represents a Backup Plan instance. * * To get more information about BackupPlan, see: * * * [API documentation](https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/reference/rest/v1/projects.locations.backupPlans) * * How-to Guides * * [Official Documentation](https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke) * * ## Example Usage * * ### Gkebackup Backupplan Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "basic-cluster", * location: "us-central1", * initialNodeCount: 1, * workloadIdentityConfig: { * workloadPool: "my-project-name.svc.id.goog", * }, * addonsConfig: { * gkeBackupAgentConfig: { * enabled: true, * }, * }, * deletionProtection: true, * network: "default", * subnetwork: "default", * }); * const basic = new gcp.gkebackup.BackupPlan("basic", { * name: "basic-plan", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * ``` * ### Gkebackup Backupplan Autopilot * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "autopilot-cluster", * location: "us-central1", * enableAutopilot: true, * ipAllocationPolicy: {}, * releaseChannel: { * channel: "RAPID", * }, * addonsConfig: { * gkeBackupAgentConfig: { * enabled: true, * }, * }, * deletionProtection: true, * network: "default", * subnetwork: "default", * }); * const autopilot = new gcp.gkebackup.BackupPlan("autopilot", { * name: "autopilot-plan", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * ``` * ### Gkebackup Backupplan Cmek * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "cmek-cluster", * location: "us-central1", * initialNodeCount: 1, * workloadIdentityConfig: { * workloadPool: "my-project-name.svc.id.goog", * }, * addonsConfig: { * gkeBackupAgentConfig: { * enabled: true, * }, * }, * deletionProtection: true, * network: "default", * subnetwork: "default", * }); * const keyRing = new gcp.kms.KeyRing("key_ring", { * name: "backup-key", * location: "us-central1", * }); * const cryptoKey = new gcp.kms.CryptoKey("crypto_key", { * name: "backup-key", * keyRing: keyRing.id, * }); * const cmek = new gcp.gkebackup.BackupPlan("cmek", { * name: "cmek-plan", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * selectedNamespaces: { * namespaces: [ * "default", * "test", * ], * }, * encryptionKey: { * gcpKmsEncryptionKey: cryptoKey.id, * }, * }, * }); * ``` * ### Gkebackup Backupplan Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "full-cluster", * location: "us-central1", * initialNodeCount: 1, * workloadIdentityConfig: { * workloadPool: "my-project-name.svc.id.goog", * }, * addonsConfig: { * gkeBackupAgentConfig: { * enabled: true, * }, * }, * deletionProtection: true, * network: "default", * subnetwork: "default", * }); * const full = new gcp.gkebackup.BackupPlan("full", { * name: "full-plan", * cluster: primary.id, * location: "us-central1", * retentionPolicy: { * backupDeleteLockDays: 30, * backupRetainDays: 180, * }, * backupSchedule: { * cronSchedule: "0 9 * * 1", * }, * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * selectedApplications: { * namespacedNames: [ * { * name: "app1", * namespace: "ns1", * }, * { * name: "app2", * namespace: "ns2", * }, * ], * }, * }, * }); * ``` * ### Gkebackup Backupplan Permissive * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "permissive-cluster", * location: "us-central1", * initialNodeCount: 1, * workloadIdentityConfig: { * workloadPool: "my-project-name.svc.id.goog", * }, * addonsConfig: { * gkeBackupAgentConfig: { * enabled: true, * }, * }, * deletionProtection: true, * network: "default", * subnetwork: "default", * }); * const permissive = new gcp.gkebackup.BackupPlan("permissive", { * name: "permissive-plan", * cluster: primary.id, * location: "us-central1", * retentionPolicy: { * backupDeleteLockDays: 30, * backupRetainDays: 180, * }, * backupSchedule: { * cronSchedule: "0 9 * * 1", * }, * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * permissiveMode: true, * selectedApplications: { * namespacedNames: [ * { * name: "app1", * namespace: "ns1", * }, * { * name: "app2", * namespace: "ns2", * }, * ], * }, * }, * }); * ``` * ### Gkebackup Backupplan Rpo Daily Window * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "rpo-daily-cluster", * location: "us-central1", * initialNodeCount: 1, * workloadIdentityConfig: { * workloadPool: "my-project-name.svc.id.goog", * }, * addonsConfig: { * gkeBackupAgentConfig: { * enabled: true, * }, * }, * deletionProtection: true, * network: "default", * subnetwork: "default", * }); * const rpoDailyWindow = new gcp.gkebackup.BackupPlan("rpo_daily_window", { * name: "rpo-daily-window", * cluster: primary.id, * location: "us-central1", * retentionPolicy: { * backupDeleteLockDays: 30, * backupRetainDays: 180, * }, * backupSchedule: { * paused: true, * rpoConfig: { * targetRpoMinutes: 1440, * exclusionWindows: [ * { * startTime: { * hours: 12, * }, * duration: "7200s", * daily: true, * }, * { * startTime: { * hours: 8, * minutes: 40, * seconds: 1, * nanos: 100, * }, * duration: "3600s", * singleOccurrenceDate: { * year: 2024, * month: 3, * day: 16, * }, * }, * ], * }, * }, * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * ``` * ### Gkebackup Backupplan Rpo Weekly Window * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "rpo-weekly-cluster", * location: "us-central1", * initialNodeCount: 1, * workloadIdentityConfig: { * workloadPool: "my-project-name.svc.id.goog", * }, * addonsConfig: { * gkeBackupAgentConfig: { * enabled: true, * }, * }, * deletionProtection: true, * network: "default", * subnetwork: "default", * }); * const rpoWeeklyWindow = new gcp.gkebackup.BackupPlan("rpo_weekly_window", { * name: "rpo-weekly-window", * cluster: primary.id, * location: "us-central1", * retentionPolicy: { * backupDeleteLockDays: 30, * backupRetainDays: 180, * }, * backupSchedule: { * paused: true, * rpoConfig: { * targetRpoMinutes: 1440, * exclusionWindows: [ * { * startTime: { * hours: 1, * minutes: 23, * }, * duration: "1800s", * daysOfWeek: { * daysOfWeeks: [ * "MONDAY", * "THURSDAY", * ], * }, * }, * { * startTime: { * hours: 12, * }, * duration: "3600s", * singleOccurrenceDate: { * year: 2024, * month: 3, * day: 17, * }, * }, * { * startTime: { * hours: 8, * minutes: 40, * }, * duration: "600s", * singleOccurrenceDate: { * year: 2024, * month: 3, * day: 18, * }, * }, * ], * }, * }, * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * ``` * * ## Import * * BackupPlan can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/backupPlans/{{name}}` * * * `{{project}}/{{location}}/{{name}}` * * * `{{location}}/{{name}}` * * When using the `pulumi import` command, BackupPlan can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:gkebackup/backupPlan:BackupPlan default projects/{{project}}/locations/{{location}}/backupPlans/{{name}} * ``` * * ```sh * $ pulumi import gcp:gkebackup/backupPlan:BackupPlan default {{project}}/{{location}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:gkebackup/backupPlan:BackupPlan default {{location}}/{{name}} * ``` */ 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["backupConfig"] = state ? state.backupConfig : undefined; resourceInputs["backupSchedule"] = state ? state.backupSchedule : undefined; resourceInputs["cluster"] = state ? state.cluster : undefined; resourceInputs["deactivated"] = state ? state.deactivated : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["etag"] = state ? state.etag : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["protectedPodCount"] = state ? state.protectedPodCount : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["retentionPolicy"] = state ? state.retentionPolicy : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["stateReason"] = state ? state.stateReason : undefined; resourceInputs["uid"] = state ? state.uid : undefined; } else { const args = argsOrState; if ((!args || args.cluster === undefined) && !opts.urn) { throw new Error("Missing required property 'cluster'"); } if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["backupConfig"] = args ? args.backupConfig : undefined; resourceInputs["backupSchedule"] = args ? args.backupSchedule : undefined; resourceInputs["cluster"] = args ? args.cluster : undefined; resourceInputs["deactivated"] = args ? args.deactivated : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["retentionPolicy"] = args ? args.retentionPolicy : undefined; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; resourceInputs["protectedPodCount"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["stateReason"] = undefined /*out*/; resourceInputs["uid"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(BackupPlan.__pulumiType, name, resourceInputs, opts); } } exports.BackupPlan = BackupPlan; /** @internal */ BackupPlan.__pulumiType = 'gcp:gkebackup/backupPlan:BackupPlan'; //# sourceMappingURL=backupPlan.js.map