"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.RestorePlan = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Represents a Restore Plan instance.
 *
 * To get more information about RestorePlan, see:
 *
 * * [API documentation](https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/reference/rest/v1/projects.locations.restorePlans)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke)
 *
 * ## Example Usage
 *
 * ### Gkebackup Restoreplan All Namespaces
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "restore-all-ns-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: "restore-all-ns",
 *     cluster: primary.id,
 *     location: "us-central1",
 *     backupConfig: {
 *         includeVolumeData: true,
 *         includeSecrets: true,
 *         allNamespaces: true,
 *     },
 * });
 * const allNs = new gcp.gkebackup.RestorePlan("all_ns", {
 *     name: "restore-all-ns",
 *     location: "us-central1",
 *     backupPlan: basic.id,
 *     cluster: primary.id,
 *     restoreConfig: {
 *         allNamespaces: true,
 *         namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
 *         volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
 *         clusterResourceRestoreScope: {
 *             allGroupKinds: true,
 *         },
 *         clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
 *     },
 * });
 * ```
 * ### Gkebackup Restoreplan Rollback Namespace
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "rollback-ns-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: "rollback-ns",
 *     cluster: primary.id,
 *     location: "us-central1",
 *     backupConfig: {
 *         includeVolumeData: true,
 *         includeSecrets: true,
 *         allNamespaces: true,
 *     },
 * });
 * const rollbackNs = new gcp.gkebackup.RestorePlan("rollback_ns", {
 *     name: "rollback-ns-rp",
 *     location: "us-central1",
 *     backupPlan: basic.id,
 *     cluster: primary.id,
 *     restoreConfig: {
 *         selectedNamespaces: {
 *             namespaces: ["my-ns"],
 *         },
 *         namespacedResourceRestoreMode: "DELETE_AND_RESTORE",
 *         volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
 *         clusterResourceRestoreScope: {
 *             selectedGroupKinds: [
 *                 {
 *                     resourceGroup: "apiextension.k8s.io",
 *                     resourceKind: "CustomResourceDefinition",
 *                 },
 *                 {
 *                     resourceGroup: "storage.k8s.io",
 *                     resourceKind: "StorageClass",
 *                 },
 *             ],
 *         },
 *         clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
 *     },
 * });
 * ```
 * ### Gkebackup Restoreplan Protected Application
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "rollback-app-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: "rollback-app",
 *     cluster: primary.id,
 *     location: "us-central1",
 *     backupConfig: {
 *         includeVolumeData: true,
 *         includeSecrets: true,
 *         allNamespaces: true,
 *     },
 * });
 * const rollbackApp = new gcp.gkebackup.RestorePlan("rollback_app", {
 *     name: "rollback-app-rp",
 *     location: "us-central1",
 *     backupPlan: basic.id,
 *     cluster: primary.id,
 *     restoreConfig: {
 *         selectedApplications: {
 *             namespacedNames: [{
 *                 name: "my-app",
 *                 namespace: "my-ns",
 *             }],
 *         },
 *         namespacedResourceRestoreMode: "DELETE_AND_RESTORE",
 *         volumeDataRestorePolicy: "REUSE_VOLUME_HANDLE_FROM_BACKUP",
 *         clusterResourceRestoreScope: {
 *             noGroupKinds: true,
 *         },
 *     },
 * });
 * ```
 * ### Gkebackup Restoreplan All Cluster Resources
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "all-groupkinds-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: "all-groupkinds",
 *     cluster: primary.id,
 *     location: "us-central1",
 *     backupConfig: {
 *         includeVolumeData: true,
 *         includeSecrets: true,
 *         allNamespaces: true,
 *     },
 * });
 * const allClusterResources = new gcp.gkebackup.RestorePlan("all_cluster_resources", {
 *     name: "all-groupkinds-rp",
 *     location: "us-central1",
 *     backupPlan: basic.id,
 *     cluster: primary.id,
 *     restoreConfig: {
 *         noNamespaces: true,
 *         namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
 *         clusterResourceRestoreScope: {
 *             allGroupKinds: true,
 *         },
 *         clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
 *     },
 * });
 * ```
 * ### Gkebackup Restoreplan Rename Namespace
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "rename-ns-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: "rename-ns",
 *     cluster: primary.id,
 *     location: "us-central1",
 *     backupConfig: {
 *         includeVolumeData: true,
 *         includeSecrets: true,
 *         allNamespaces: true,
 *     },
 * });
 * const renameNs = new gcp.gkebackup.RestorePlan("rename_ns", {
 *     name: "rename-ns-rp",
 *     location: "us-central1",
 *     backupPlan: basic.id,
 *     cluster: primary.id,
 *     restoreConfig: {
 *         selectedNamespaces: {
 *             namespaces: ["ns1"],
 *         },
 *         namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
 *         volumeDataRestorePolicy: "REUSE_VOLUME_HANDLE_FROM_BACKUP",
 *         clusterResourceRestoreScope: {
 *             noGroupKinds: true,
 *         },
 *         transformationRules: [
 *             {
 *                 description: "rename namespace from ns1 to ns2",
 *                 resourceFilter: {
 *                     groupKinds: [{
 *                         resourceKind: "Namespace",
 *                     }],
 *                     jsonPath: ".metadata[?(@.name == 'ns1')]",
 *                 },
 *                 fieldActions: [{
 *                     op: "REPLACE",
 *                     path: "/metadata/name",
 *                     value: "ns2",
 *                 }],
 *             },
 *             {
 *                 description: "move all resources from ns1 to ns2",
 *                 resourceFilter: {
 *                     namespaces: ["ns1"],
 *                 },
 *                 fieldActions: [{
 *                     op: "REPLACE",
 *                     path: "/metadata/namespace",
 *                     value: "ns2",
 *                 }],
 *             },
 *         ],
 *     },
 * });
 * ```
 * ### Gkebackup Restoreplan Second Transformation
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "transform-rule-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: "transform-rule",
 *     cluster: primary.id,
 *     location: "us-central1",
 *     backupConfig: {
 *         includeVolumeData: true,
 *         includeSecrets: true,
 *         allNamespaces: true,
 *     },
 * });
 * const transformRule = new gcp.gkebackup.RestorePlan("transform_rule", {
 *     name: "transform-rule-rp",
 *     description: "copy nginx env variables",
 *     labels: {
 *         app: "nginx",
 *     },
 *     location: "us-central1",
 *     backupPlan: basic.id,
 *     cluster: primary.id,
 *     restoreConfig: {
 *         excludedNamespaces: {
 *             namespaces: ["my-ns"],
 *         },
 *         namespacedResourceRestoreMode: "DELETE_AND_RESTORE",
 *         volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
 *         clusterResourceRestoreScope: {
 *             excludedGroupKinds: [{
 *                 resourceGroup: "apiextension.k8s.io",
 *                 resourceKind: "CustomResourceDefinition",
 *             }],
 *         },
 *         clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
 *         transformationRules: [{
 *             description: "Copy environment variables from the nginx container to the install init container.",
 *             resourceFilter: {
 *                 groupKinds: [{
 *                     resourceKind: "Pod",
 *                     resourceGroup: "",
 *                 }],
 *                 jsonPath: ".metadata[?(@.name == 'nginx')]",
 *             },
 *             fieldActions: [{
 *                 op: "COPY",
 *                 path: "/spec/initContainers/0/env",
 *                 fromPath: "/spec/containers/0/env",
 *             }],
 *         }],
 *     },
 * });
 * ```
 * ### Gkebackup Restoreplan Gitops Mode
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "gitops-mode-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: "gitops-mode",
 *     cluster: primary.id,
 *     location: "us-central1",
 *     backupConfig: {
 *         includeVolumeData: true,
 *         includeSecrets: true,
 *         allNamespaces: true,
 *     },
 * });
 * const gitopsMode = new gcp.gkebackup.RestorePlan("gitops_mode", {
 *     name: "gitops-mode",
 *     location: "us-central1",
 *     backupPlan: basic.id,
 *     cluster: primary.id,
 *     restoreConfig: {
 *         allNamespaces: true,
 *         namespacedResourceRestoreMode: "MERGE_SKIP_ON_CONFLICT",
 *         volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
 *         clusterResourceRestoreScope: {
 *             allGroupKinds: true,
 *         },
 *         clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
 *     },
 * });
 * ```
 * ### Gkebackup Restoreplan Restore Order
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "restore-order-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: "restore-order",
 *     cluster: primary.id,
 *     location: "us-central1",
 *     backupConfig: {
 *         includeVolumeData: true,
 *         includeSecrets: true,
 *         allNamespaces: true,
 *     },
 * });
 * const restoreOrder = new gcp.gkebackup.RestorePlan("restore_order", {
 *     name: "restore-order",
 *     location: "us-central1",
 *     backupPlan: basic.id,
 *     cluster: primary.id,
 *     restoreConfig: {
 *         allNamespaces: true,
 *         namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
 *         volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
 *         clusterResourceRestoreScope: {
 *             allGroupKinds: true,
 *         },
 *         clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
 *         restoreOrder: {
 *             groupKindDependencies: [
 *                 {
 *                     satisfying: {
 *                         resourceGroup: "stable.example.com",
 *                         resourceKind: "kindA",
 *                     },
 *                     requiring: {
 *                         resourceGroup: "stable.example.com",
 *                         resourceKind: "kindB",
 *                     },
 *                 },
 *                 {
 *                     satisfying: {
 *                         resourceGroup: "stable.example.com",
 *                         resourceKind: "kindB",
 *                     },
 *                     requiring: {
 *                         resourceGroup: "stable.example.com",
 *                         resourceKind: "kindC",
 *                     },
 *                 },
 *             ],
 *         },
 *     },
 * });
 * ```
 * ### Gkebackup Restoreplan Volume Res
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "volume-res-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: "volume-res",
 *     cluster: primary.id,
 *     location: "us-central1",
 *     backupConfig: {
 *         includeVolumeData: true,
 *         includeSecrets: true,
 *         allNamespaces: true,
 *     },
 * });
 * const volumeRes = new gcp.gkebackup.RestorePlan("volume_res", {
 *     name: "volume-res",
 *     location: "us-central1",
 *     backupPlan: basic.id,
 *     cluster: primary.id,
 *     restoreConfig: {
 *         allNamespaces: true,
 *         namespacedResourceRestoreMode: "FAIL_ON_CONFLICT",
 *         volumeDataRestorePolicy: "NO_VOLUME_DATA_RESTORATION",
 *         clusterResourceRestoreScope: {
 *             allGroupKinds: true,
 *         },
 *         clusterResourceConflictPolicy: "USE_EXISTING_VERSION",
 *         volumeDataRestorePolicyBindings: [{
 *             policy: "RESTORE_VOLUME_DATA_FROM_BACKUP",
 *             volumeType: "GCE_PERSISTENT_DISK",
 *         }],
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * RestorePlan can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/restorePlans/{{name}}`
 *
 * * `{{project}}/{{location}}/{{name}}`
 *
 * * `{{location}}/{{name}}`
 *
 * When using the `pulumi import` command, RestorePlan can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:gkebackup/restorePlan:RestorePlan default projects/{{project}}/locations/{{location}}/restorePlans/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:gkebackup/restorePlan:RestorePlan default {{project}}/{{location}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:gkebackup/restorePlan:RestorePlan default {{location}}/{{name}}
 * ```
 */
class RestorePlan extends pulumi.CustomResource {
    /**
     * Get an existing RestorePlan 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 RestorePlan(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of RestorePlan.  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'] === RestorePlan.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["backupPlan"] = state?.backupPlan;
            resourceInputs["cluster"] = state?.cluster;
            resourceInputs["description"] = state?.description;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["restoreConfig"] = state?.restoreConfig;
            resourceInputs["state"] = state?.state;
            resourceInputs["stateReason"] = state?.stateReason;
            resourceInputs["uid"] = state?.uid;
        }
        else {
            const args = argsOrState;
            if (args?.backupPlan === undefined && !opts.urn) {
                throw new Error("Missing required property 'backupPlan'");
            }
            if (args?.cluster === undefined && !opts.urn) {
                throw new Error("Missing required property 'cluster'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.restoreConfig === undefined && !opts.urn) {
                throw new Error("Missing required property 'restoreConfig'");
            }
            resourceInputs["backupPlan"] = args?.backupPlan;
            resourceInputs["cluster"] = args?.cluster;
            resourceInputs["description"] = args?.description;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["restoreConfig"] = args?.restoreConfig;
            resourceInputs["effectiveLabels"] = 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(RestorePlan.__pulumiType, name, resourceInputs, opts);
    }
}
exports.RestorePlan = RestorePlan;
/** @internal */
RestorePlan.__pulumiType = 'gcp:gkebackup/restorePlan:RestorePlan';
//# sourceMappingURL=restorePlan.js.map