"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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackupInstanceKubernetesCluster = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Backup Instance to back up a Kubernetes Cluster.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const current = azure.core.getClientConfig({});
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example",
 *     location: "West Europe",
 * });
 * const snap = new azure.core.ResourceGroup("snap", {
 *     name: "example-snap",
 *     location: "West Europe",
 * });
 * const exampleBackupVault = new azure.dataprotection.BackupVault("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     datastoreType: "VaultStore",
 *     redundancy: "LocallyRedundant",
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 * });
 * const exampleKubernetesCluster = new azure.containerservice.KubernetesCluster("example", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     dnsPrefix: "dns",
 *     defaultNodePool: {
 *         name: "default",
 *         nodeCount: 1,
 *         vmSize: "Standard_DS2_v2",
 *         hostEncryptionEnabled: true,
 *     },
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 * });
 * const aksClusterTrustedAccess = new azure.containerservice.ClusterTrustedAccessRoleBinding("aks_cluster_trusted_access", {
 *     kubernetesClusterId: exampleKubernetesCluster.id,
 *     name: "example",
 *     roles: ["Microsoft.DataProtection/backupVaults/backup-operator"],
 *     sourceResourceId: exampleBackupVault.id,
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleContainer = new azure.storage.Container("example", {
 *     name: "example",
 *     storageAccountName: exampleAccount.name,
 *     containerAccessType: "private",
 * });
 * const exampleKubernetesClusterExtension = new azure.containerservice.KubernetesClusterExtension("example", {
 *     name: "example",
 *     clusterId: exampleKubernetesCluster.id,
 *     extensionType: "Microsoft.DataProtection.Kubernetes",
 *     releaseTrain: "stable",
 *     releaseNamespace: "dataprotection-microsoft",
 *     configurationSettings: {
 *         "configuration.backupStorageLocation.bucket": exampleContainer.name,
 *         "configuration.backupStorageLocation.config.resourceGroup": example.name,
 *         "configuration.backupStorageLocation.config.storageAccount": exampleAccount.name,
 *         "configuration.backupStorageLocation.config.subscriptionId": current.then(current => current.subscriptionId),
 *         "credentials.tenantId": current.then(current => current.tenantId),
 *     },
 * });
 * const testExtensionAndStorageAccountPermission = new azure.authorization.Assignment("test_extension_and_storage_account_permission", {
 *     scope: exampleAccount.id,
 *     roleDefinitionName: "Storage Account Contributor",
 *     principalId: exampleKubernetesClusterExtension.aksAssignedIdentities.apply(aksAssignedIdentities => aksAssignedIdentities[0].principalId),
 * });
 * const testVaultMsiReadOnCluster = new azure.authorization.Assignment("test_vault_msi_read_on_cluster", {
 *     scope: exampleKubernetesCluster.id,
 *     roleDefinitionName: "Reader",
 *     principalId: exampleBackupVault.identity.apply(identity => identity?.principalId),
 * });
 * const testVaultMsiReadOnSnapRg = new azure.authorization.Assignment("test_vault_msi_read_on_snap_rg", {
 *     scope: snap.id,
 *     roleDefinitionName: "Reader",
 *     principalId: exampleBackupVault.identity.apply(identity => identity?.principalId),
 * });
 * const testVaultMsiSnapshotContributorOnSnapRg = new azure.authorization.Assignment("test_vault_msi_snapshot_contributor_on_snap_rg", {
 *     scope: snap.id,
 *     roleDefinitionName: "Disk Snapshot Contributor",
 *     principalId: exampleBackupVault.identity.apply(identity => identity?.principalId),
 * });
 * const testVaultDataOperatorOnSnapRg = new azure.authorization.Assignment("test_vault_data_operator_on_snap_rg", {
 *     scope: snap.id,
 *     roleDefinitionName: "Data Operator for Managed Disks",
 *     principalId: exampleBackupVault.identity.apply(identity => identity?.principalId),
 * });
 * const testVaultDataContributorOnStorage = new azure.authorization.Assignment("test_vault_data_contributor_on_storage", {
 *     scope: exampleAccount.id,
 *     roleDefinitionName: "Storage Blob Data Contributor",
 *     principalId: exampleBackupVault.identity.apply(identity => identity?.principalId),
 * });
 * const testClusterMsiContributorOnSnapRg = new azure.authorization.Assignment("test_cluster_msi_contributor_on_snap_rg", {
 *     scope: snap.id,
 *     roleDefinitionName: "Contributor",
 *     principalId: exampleKubernetesCluster.identity.apply(identity => identity?.principalId),
 * });
 * const exampleBackupPolicyKubernetesCluster = new azure.dataprotection.BackupPolicyKubernetesCluster("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     vaultName: exampleBackupVault.name,
 *     backupRepeatingTimeIntervals: ["R/2023-05-23T02:30:00+00:00/P1W"],
 *     retentionRules: [{
 *         name: "Daily",
 *         priority: 25,
 *         lifeCycles: [{
 *             duration: "P84D",
 *             dataStoreType: "OperationalStore",
 *         }],
 *         criteria: {
 *             daysOfWeeks: ["Thursday"],
 *             monthsOfYears: ["November"],
 *             weeksOfMonths: ["First"],
 *             scheduledBackupTimes: ["2023-05-23T02:30:00Z"],
 *         },
 *     }],
 *     defaultRetentionRule: {
 *         lifeCycles: [{
 *             duration: "P14D",
 *             dataStoreType: "OperationalStore",
 *         }],
 *     },
 * });
 * const exampleBackupInstanceKubernetesCluster = new azure.dataprotection.BackupInstanceKubernetesCluster("example", {
 *     name: "example",
 *     location: example.location,
 *     vaultId: exampleBackupVault.id,
 *     kubernetesClusterId: exampleKubernetesCluster.id,
 *     snapshotResourceGroupName: snap.name,
 *     backupPolicyId: exampleBackupPolicyKubernetesCluster.id,
 *     backupDatasourceParameters: {
 *         excludedNamespaces: ["test-excluded-namespaces"],
 *         excludedResourceTypes: ["exvolumesnapshotcontents.snapshot.storage.k8s.io"],
 *         clusterScopedResourcesEnabled: true,
 *         includedNamespaces: ["test-included-namespaces"],
 *         includedResourceTypes: ["involumesnapshotcontents.snapshot.storage.k8s.io"],
 *         labelSelectors: ["kubernetes.io/metadata.name:test"],
 *         volumeSnapshotEnabled: true,
 *     },
 * }, {
 *     dependsOn: [
 *         testExtensionAndStorageAccountPermission,
 *         testVaultMsiReadOnCluster,
 *         testVaultMsiReadOnSnapRg,
 *         testClusterMsiContributorOnSnapRg,
 *         testVaultMsiSnapshotContributorOnSnapRg,
 *         testVaultDataOperatorOnSnapRg,
 *         testVaultDataContributorOnStorage,
 *     ],
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.DataProtection` - 2025-07-01
 *
 * ## Import
 *
 * Backup Instance Kubernetes Cluster can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:dataprotection/backupInstanceKubernetesCluster:BackupInstanceKubernetesCluster example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataProtection/backupVaults/vault1/backupInstances/backupInstance1
 * ```
 */
class BackupInstanceKubernetesCluster extends pulumi.CustomResource {
    /**
     * Get an existing BackupInstanceKubernetesCluster 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 BackupInstanceKubernetesCluster(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:dataprotection/backupInstanceKubernetesCluster:BackupInstanceKubernetesCluster';
    /**
     * Returns true if the given object is an instance of BackupInstanceKubernetesCluster.  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'] === BackupInstanceKubernetesCluster.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["backupDatasourceParameters"] = state?.backupDatasourceParameters;
            resourceInputs["backupPolicyId"] = state?.backupPolicyId;
            resourceInputs["kubernetesClusterId"] = state?.kubernetesClusterId;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["protectionState"] = state?.protectionState;
            resourceInputs["snapshotResourceGroupName"] = state?.snapshotResourceGroupName;
            resourceInputs["vaultId"] = state?.vaultId;
        }
        else {
            const args = argsOrState;
            if (args?.backupPolicyId === undefined && !opts.urn) {
                throw new Error("Missing required property 'backupPolicyId'");
            }
            if (args?.kubernetesClusterId === undefined && !opts.urn) {
                throw new Error("Missing required property 'kubernetesClusterId'");
            }
            if (args?.snapshotResourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'snapshotResourceGroupName'");
            }
            if (args?.vaultId === undefined && !opts.urn) {
                throw new Error("Missing required property 'vaultId'");
            }
            resourceInputs["backupDatasourceParameters"] = args?.backupDatasourceParameters;
            resourceInputs["backupPolicyId"] = args?.backupPolicyId;
            resourceInputs["kubernetesClusterId"] = args?.kubernetesClusterId;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["snapshotResourceGroupName"] = args?.snapshotResourceGroupName;
            resourceInputs["vaultId"] = args?.vaultId;
            resourceInputs["protectionState"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(BackupInstanceKubernetesCluster.__pulumiType, name, resourceInputs, opts);
    }
}
exports.BackupInstanceKubernetesCluster = BackupInstanceKubernetesCluster;
//# sourceMappingURL=backupInstanceKubernetesCluster.js.map