"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.Certificate = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Key Vault Certificate.
 *
 * ## Example Usage
 *
 * ### Importing A PFX)
 *
 * > **Note:** this example assumed the PFX file is located in the same directory at `certificate-to-import.pfx`.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 *
 * 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",
 *     accessPolicies: [{
 *         tenantId: current.then(current => current.tenantId),
 *         objectId: current.then(current => current.objectId),
 *         certificatePermissions: [
 *             "Create",
 *             "Delete",
 *             "DeleteIssuers",
 *             "Get",
 *             "GetIssuers",
 *             "Import",
 *             "List",
 *             "ListIssuers",
 *             "ManageContacts",
 *             "ManageIssuers",
 *             "SetIssuers",
 *             "Update",
 *         ],
 *         keyPermissions: [
 *             "Backup",
 *             "Create",
 *             "Decrypt",
 *             "Delete",
 *             "Encrypt",
 *             "Get",
 *             "Import",
 *             "List",
 *             "Purge",
 *             "Recover",
 *             "Restore",
 *             "Sign",
 *             "UnwrapKey",
 *             "Update",
 *             "Verify",
 *             "WrapKey",
 *         ],
 *         secretPermissions: [
 *             "Backup",
 *             "Delete",
 *             "Get",
 *             "List",
 *             "Purge",
 *             "Recover",
 *             "Restore",
 *             "Set",
 *         ],
 *     }],
 * });
 * const exampleCertificate = new azure.keyvault.Certificate("example", {
 *     name: "imported-cert",
 *     keyVaultId: exampleKeyVault.id,
 *     certificate: {
 *         contents: std.filebase64({
 *             input: "certificate-to-import.pfx",
 *         }).then(invoke => invoke.result),
 *         password: "",
 *     },
 * });
 * ```
 *
 * ### Generating a new certificate
 *
 * ```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: "standard",
 *     softDeleteRetentionDays: 7,
 *     accessPolicies: [{
 *         tenantId: current.then(current => current.tenantId),
 *         objectId: current.then(current => current.objectId),
 *         certificatePermissions: [
 *             "Create",
 *             "Delete",
 *             "DeleteIssuers",
 *             "Get",
 *             "GetIssuers",
 *             "Import",
 *             "List",
 *             "ListIssuers",
 *             "ManageContacts",
 *             "ManageIssuers",
 *             "Purge",
 *             "SetIssuers",
 *             "Update",
 *         ],
 *         keyPermissions: [
 *             "Backup",
 *             "Create",
 *             "Decrypt",
 *             "Delete",
 *             "Encrypt",
 *             "Get",
 *             "Import",
 *             "List",
 *             "Purge",
 *             "Recover",
 *             "Restore",
 *             "Sign",
 *             "UnwrapKey",
 *             "Update",
 *             "Verify",
 *             "WrapKey",
 *         ],
 *         secretPermissions: [
 *             "Backup",
 *             "Delete",
 *             "Get",
 *             "List",
 *             "Purge",
 *             "Recover",
 *             "Restore",
 *             "Set",
 *         ],
 *     }],
 * });
 * const exampleCertificate = new azure.keyvault.Certificate("example", {
 *     name: "generated-cert",
 *     keyVaultId: exampleKeyVault.id,
 *     certificatePolicy: {
 *         issuerParameters: {
 *             name: "Self",
 *         },
 *         keyProperties: {
 *             exportable: true,
 *             keySize: 2048,
 *             keyType: "RSA",
 *             reuseKey: true,
 *         },
 *         lifetimeActions: [{
 *             action: {
 *                 actionType: "AutoRenew",
 *             },
 *             trigger: {
 *                 daysBeforeExpiry: 30,
 *             },
 *         }],
 *         secretProperties: {
 *             contentType: "application/x-pkcs12",
 *         },
 *         x509CertificateProperties: {
 *             extendedKeyUsages: ["1.3.6.1.5.5.7.3.1"],
 *             keyUsages: [
 *                 "cRLSign",
 *                 "dataEncipherment",
 *                 "digitalSignature",
 *                 "keyAgreement",
 *                 "keyCertSign",
 *                 "keyEncipherment",
 *             ],
 *             subjectAlternativeNames: {
 *                 dnsNames: [
 *                     "internal.contoso.com",
 *                     "domain.hello.world",
 *                 ],
 *             },
 *             subject: "CN=hello-world",
 *             validityInMonths: 12,
 *         },
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * Key Vault Certificates can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:keyvault/certificate:Certificate example "https://example-keyvault.vault.azure.net/certificates/example/fdf067c93bbb4b22bff4d8b7a9a56217"
 * ```
 */
class Certificate extends pulumi.CustomResource {
    /**
     * Get an existing Certificate 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 Certificate(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:keyvault/certificate:Certificate';
    /**
     * Returns true if the given object is an instance of Certificate.  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'] === Certificate.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["certificate"] = state?.certificate;
            resourceInputs["certificateAttributes"] = state?.certificateAttributes;
            resourceInputs["certificateData"] = state?.certificateData;
            resourceInputs["certificateDataBase64"] = state?.certificateDataBase64;
            resourceInputs["certificatePolicy"] = state?.certificatePolicy;
            resourceInputs["keyVaultId"] = state?.keyVaultId;
            resourceInputs["name"] = state?.name;
            resourceInputs["resourceManagerId"] = state?.resourceManagerId;
            resourceInputs["resourceManagerVersionlessId"] = state?.resourceManagerVersionlessId;
            resourceInputs["secretId"] = state?.secretId;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["thumbprint"] = state?.thumbprint;
            resourceInputs["version"] = state?.version;
            resourceInputs["versionlessId"] = state?.versionlessId;
            resourceInputs["versionlessSecretId"] = state?.versionlessSecretId;
        }
        else {
            const args = argsOrState;
            if (args?.keyVaultId === undefined && !opts.urn) {
                throw new Error("Missing required property 'keyVaultId'");
            }
            resourceInputs["certificate"] = args?.certificate;
            resourceInputs["certificatePolicy"] = args?.certificatePolicy;
            resourceInputs["keyVaultId"] = args?.keyVaultId;
            resourceInputs["name"] = args?.name;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["certificateAttributes"] = undefined /*out*/;
            resourceInputs["certificateData"] = undefined /*out*/;
            resourceInputs["certificateDataBase64"] = undefined /*out*/;
            resourceInputs["resourceManagerId"] = undefined /*out*/;
            resourceInputs["resourceManagerVersionlessId"] = undefined /*out*/;
            resourceInputs["secretId"] = undefined /*out*/;
            resourceInputs["thumbprint"] = undefined /*out*/;
            resourceInputs["version"] = undefined /*out*/;
            resourceInputs["versionlessId"] = undefined /*out*/;
            resourceInputs["versionlessSecretId"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const aliasOpts = { aliases: [{ type: "azure:keyvault/certifiate:Certifiate" }] };
        opts = pulumi.mergeOptions(opts, aliasOpts);
        super(Certificate.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Certificate = Certificate;
//# sourceMappingURL=certificate.js.map