"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.Key = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Key Vault Key.
 *
 * ## Example Usage
 *
 * > **Note:** To use this resource, your client should have RBAC roles with permissions like `Key Vault Crypto Officer` or `Key Vault Administrator` or an assigned Key Vault Access Policy with permissions `Create`,`Delete`,`Get`,`Purge`,`Recover`,`Update` and `GetRotationPolicy` for keys without Rotation Policy. Include `SetRotationPolicy` for keys with Rotation Policy.
 *
 * > **Note:** The Azure Provider includes a Feature Toggle which will purge a Key Vault Key resource on destroy, rather than the default soft-delete. See `purgeSoftDeletedKeysOnDestroy` for more information.
 *
 * ### Additional Examples
 *
 * ```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-resources",
 *     location: "West Europe",
 * });
 * const exampleKeyVault = new azure.keyvault.KeyVault("example", {
 *     name: "examplekeyvault",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     tenantId: current.then(current => current.tenantId),
 *     skuName: "premium",
 *     softDeleteRetentionDays: 7,
 *     accessPolicies: [{
 *         tenantId: current.then(current => current.tenantId),
 *         objectId: current.then(current => current.objectId),
 *         keyPermissions: [
 *             "Create",
 *             "Delete",
 *             "Get",
 *             "Purge",
 *             "Recover",
 *             "Update",
 *             "GetRotationPolicy",
 *             "SetRotationPolicy",
 *         ],
 *         secretPermissions: ["Set"],
 *     }],
 * });
 * const generated = new azure.keyvault.Key("generated", {
 *     name: "generated-certificate",
 *     keyVaultId: exampleKeyVault.id,
 *     keyType: "RSA",
 *     keySize: 2048,
 *     keyOpts: [
 *         "decrypt",
 *         "encrypt",
 *         "sign",
 *         "unwrapKey",
 *         "verify",
 *         "wrapKey",
 *     ],
 *     rotationPolicy: {
 *         automatic: {
 *             timeBeforeExpiry: "P30D",
 *         },
 *         expireAfter: "P90D",
 *         notifyBeforeExpiry: "P29D",
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * Key Vault Key which is Enabled can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:keyvault/key:Key example "https://example-keyvault.vault.azure.net/keys/example/fdf067c93bbb4b22bff4d8b7a9a56217"
 * ```
 */
class Key extends pulumi.CustomResource {
    /**
     * Get an existing Key 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 Key(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:keyvault/key:Key';
    /**
     * Returns true if the given object is an instance of Key.  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'] === Key.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["curve"] = state?.curve;
            resourceInputs["e"] = state?.e;
            resourceInputs["expirationDate"] = state?.expirationDate;
            resourceInputs["keyOpts"] = state?.keyOpts;
            resourceInputs["keySize"] = state?.keySize;
            resourceInputs["keyType"] = state?.keyType;
            resourceInputs["keyVaultId"] = state?.keyVaultId;
            resourceInputs["n"] = state?.n;
            resourceInputs["name"] = state?.name;
            resourceInputs["notBeforeDate"] = state?.notBeforeDate;
            resourceInputs["publicKeyOpenssh"] = state?.publicKeyOpenssh;
            resourceInputs["publicKeyPem"] = state?.publicKeyPem;
            resourceInputs["resourceId"] = state?.resourceId;
            resourceInputs["resourceVersionlessId"] = state?.resourceVersionlessId;
            resourceInputs["rotationPolicy"] = state?.rotationPolicy;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["version"] = state?.version;
            resourceInputs["versionlessId"] = state?.versionlessId;
            resourceInputs["x"] = state?.x;
            resourceInputs["y"] = state?.y;
        }
        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?.keyVaultId === undefined && !opts.urn) {
                throw new Error("Missing required property 'keyVaultId'");
            }
            resourceInputs["curve"] = args?.curve;
            resourceInputs["expirationDate"] = args?.expirationDate;
            resourceInputs["keyOpts"] = args?.keyOpts;
            resourceInputs["keySize"] = args?.keySize;
            resourceInputs["keyType"] = args?.keyType;
            resourceInputs["keyVaultId"] = args?.keyVaultId;
            resourceInputs["name"] = args?.name;
            resourceInputs["notBeforeDate"] = args?.notBeforeDate;
            resourceInputs["rotationPolicy"] = args?.rotationPolicy;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["e"] = undefined /*out*/;
            resourceInputs["n"] = undefined /*out*/;
            resourceInputs["publicKeyOpenssh"] = undefined /*out*/;
            resourceInputs["publicKeyPem"] = undefined /*out*/;
            resourceInputs["resourceId"] = undefined /*out*/;
            resourceInputs["resourceVersionlessId"] = undefined /*out*/;
            resourceInputs["version"] = undefined /*out*/;
            resourceInputs["versionlessId"] = undefined /*out*/;
            resourceInputs["x"] = undefined /*out*/;
            resourceInputs["y"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Key.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Key = Key;
//# sourceMappingURL=key.js.map