"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.ManagedHardwareSecurityModuleKey = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Key Vault Managed Hardware Security Module Key.
 *
 * > **Note:** The Azure Provider includes a Feature Toggle which will purge a Key Vault Managed Hardware Security Module Key resource on destroy, rather than the default soft-delete. See `purgeSoftDeletedHardwareSecurityModulesOnDestroy` for more information.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const current = azure.core.getClientConfig({});
 * const example = new azure.keyvault.ManagedHardwareSecurityModule("example", {
 *     name: "example",
 *     resourceGroupName: exampleAzurermResourceGroup.name,
 *     location: exampleAzurermResourceGroup.location,
 *     skuName: "Standard_B1",
 *     tenantId: current.then(current => current.tenantId),
 *     adminObjectIds: [current.then(current => current.objectId)],
 *     purgeProtectionEnabled: false,
 *     activeConfig: [{
 *         securityDomainCertificate: [
 *             cert[0].id,
 *             cert[1].id,
 *             cert[2].id,
 *         ],
 *         securityDomainQuorum: 2,
 *     }],
 * });
 * // this gives your service principal the HSM Crypto User role which lets you create and destroy hsm keys
 * const hsm_crypto_user = new azure.keyvault.ManagedHardwareSecurityModuleRoleAssignment("hsm-crypto-user", {
 *     managedHsmId: test.id,
 *     name: "1e243909-064c-6ac3-84e9-1c8bf8d6ad22",
 *     scope: "/keys",
 *     roleDefinitionId: "/Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/21dbd100-6940-42c2-9190-5d6cb909625b",
 *     principalId: current.then(current => current.objectId),
 * });
 * // this gives your service principal the HSM Crypto Officer role which lets you purge hsm keys
 * const hsm_crypto_officer = new azure.keyvault.ManagedHardwareSecurityModuleRoleAssignment("hsm-crypto-officer", {
 *     managedHsmId: test.id,
 *     name: "1e243909-064c-6ac3-84e9-1c8bf8d6ad23",
 *     scope: "/keys",
 *     roleDefinitionId: "/Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/515eb02d-2335-4d2d-92f2-b1cbdf9c3778",
 *     principalId: current.then(current => current.objectId),
 * });
 * const exampleManagedHardwareSecurityModuleKey = new azure.keyvault.ManagedHardwareSecurityModuleKey("example", {
 *     name: "example",
 *     managedHsmId: test.id,
 *     keyType: "EC-HSM",
 *     curve: "P-521",
 *     keyOpts: ["sign"],
 * }, {
 *     dependsOn: [
 *         testAzurermKeyVaultManagedHardwareSecurityModuleRoleAssignment,
 *         test1,
 *     ],
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.KeyVault` - 2023-07-01
 *
 * ## Import
 *
 * Key Vault Managed Hardware Security Module Key can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:keyvault/managedHardwareSecurityModuleKey:ManagedHardwareSecurityModuleKey example https://exampleHSM.managedhsm.azure.net/keys/exampleKey
 * ```
 */
class ManagedHardwareSecurityModuleKey extends pulumi.CustomResource {
    /**
     * Get an existing ManagedHardwareSecurityModuleKey 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 ManagedHardwareSecurityModuleKey(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:keyvault/managedHardwareSecurityModuleKey:ManagedHardwareSecurityModuleKey';
    /**
     * Returns true if the given object is an instance of ManagedHardwareSecurityModuleKey.  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'] === ManagedHardwareSecurityModuleKey.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["curve"] = state?.curve;
            resourceInputs["expirationDate"] = state?.expirationDate;
            resourceInputs["keyOpts"] = state?.keyOpts;
            resourceInputs["keySize"] = state?.keySize;
            resourceInputs["keyType"] = state?.keyType;
            resourceInputs["managedHsmId"] = state?.managedHsmId;
            resourceInputs["name"] = state?.name;
            resourceInputs["notBeforeDate"] = state?.notBeforeDate;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["versionedId"] = state?.versionedId;
        }
        else {
            const args = argsOrState;
            if (args?.keyOpts === undefined && !opts.urn) {
                throw new Error("Missing required property 'keyOpts'");
            }
            if (args?.keyType === undefined && !opts.urn) {
                throw new Error("Missing required property 'keyType'");
            }
            if (args?.managedHsmId === undefined && !opts.urn) {
                throw new Error("Missing required property 'managedHsmId'");
            }
            resourceInputs["curve"] = args?.curve;
            resourceInputs["expirationDate"] = args?.expirationDate;
            resourceInputs["keyOpts"] = args?.keyOpts;
            resourceInputs["keySize"] = args?.keySize;
            resourceInputs["keyType"] = args?.keyType;
            resourceInputs["managedHsmId"] = args?.managedHsmId;
            resourceInputs["name"] = args?.name;
            resourceInputs["notBeforeDate"] = args?.notBeforeDate;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["versionedId"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(ManagedHardwareSecurityModuleKey.__pulumiType, name, resourceInputs, opts);
    }
}
exports.ManagedHardwareSecurityModuleKey = ManagedHardwareSecurityModuleKey;
//# sourceMappingURL=managedHardwareSecurityModuleKey.js.map