"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.AccessPolicy = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Key Vault Access Policy.
 *
 * > **NOTE:** It's possible to define Key Vault Access Policies both within the `azure.keyvault.KeyVault` resource via the `accessPolicy` block and by using the `azure.keyvault.AccessPolicy` resource. However it's not possible to use both methods to manage Access Policies within a KeyVault, since there'll be conflicts.
 *
 * > **NOTE:** Azure permits a maximum of 1024 Access Policies per Key Vault - [more information can be found in this document](https://docs.microsoft.com/azure/key-vault/key-vault-secure-your-key-vault#data-plane-access-control).
 *
 * ## Import
 *
 * Key Vault Access Policies can be imported using the Resource ID of the Key Vault, plus some additional metadata.
 *
 * If both an `objectId` and `applicationId` are specified, then the Access Policy can be imported using the following code:
 *
 * ```sh
 * $ pulumi import azure:keyvault/accessPolicy:AccessPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.KeyVault/vaults/test-vault/objectId/11111111-1111-1111-1111-111111111111/applicationId/22222222-2222-2222-2222-222222222222
 * ```
 *
 * where `11111111-1111-1111-1111-111111111111` is the `objectId` and `22222222-2222-2222-2222-222222222222` is the `applicationId`.
 *
 * ***
 *
 * Access Policies with an `objectId` but no `applicationId` can be imported using the following command:
 *
 * ```sh
 * $ pulumi import azure:keyvault/accessPolicy:AccessPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.KeyVault/vaults/test-vault/objectId/11111111-1111-1111-1111-111111111111
 * ```
 *
 * where `11111111-1111-1111-1111-111111111111` is the `objectId`.
 *
 * > **NOTE:** Both Identifiers are unique to this provider and don't map to an existing object within Azure.
 */
class AccessPolicy extends pulumi.CustomResource {
    /**
     * Get an existing AccessPolicy 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 AccessPolicy(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:keyvault/accessPolicy:AccessPolicy';
    /**
     * Returns true if the given object is an instance of AccessPolicy.  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'] === AccessPolicy.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["applicationId"] = state?.applicationId;
            resourceInputs["certificatePermissions"] = state?.certificatePermissions;
            resourceInputs["keyPermissions"] = state?.keyPermissions;
            resourceInputs["keyVaultId"] = state?.keyVaultId;
            resourceInputs["objectId"] = state?.objectId;
            resourceInputs["secretPermissions"] = state?.secretPermissions;
            resourceInputs["storagePermissions"] = state?.storagePermissions;
            resourceInputs["tenantId"] = state?.tenantId;
        }
        else {
            const args = argsOrState;
            if (args?.keyVaultId === undefined && !opts.urn) {
                throw new Error("Missing required property 'keyVaultId'");
            }
            if (args?.objectId === undefined && !opts.urn) {
                throw new Error("Missing required property 'objectId'");
            }
            if (args?.tenantId === undefined && !opts.urn) {
                throw new Error("Missing required property 'tenantId'");
            }
            resourceInputs["applicationId"] = args?.applicationId;
            resourceInputs["certificatePermissions"] = args?.certificatePermissions;
            resourceInputs["keyPermissions"] = args?.keyPermissions;
            resourceInputs["keyVaultId"] = args?.keyVaultId;
            resourceInputs["objectId"] = args?.objectId;
            resourceInputs["secretPermissions"] = args?.secretPermissions;
            resourceInputs["storagePermissions"] = args?.storagePermissions;
            resourceInputs["tenantId"] = args?.tenantId;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(AccessPolicy.__pulumiType, name, resourceInputs, opts);
    }
}
exports.AccessPolicy = AccessPolicy;
//# sourceMappingURL=accessPolicy.js.map