"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.Assignment = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Blueprint Assignment resource
 *
 * > **NOTE:** Azure Blueprints are in Preview and potentially subject to breaking change without notice.
 *
 * > **NOTE:** Azure Blueprint Assignments can only be applied to Subscriptions.  Assignments to Management Groups is not currently supported by the service or by this provider.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const current = azure.core.getClientConfig({});
 * const example = azure.core.getSubscription({});
 * const exampleGetDefinition = example.then(example => azure.blueprint.getDefinition({
 *     name: "exampleBlueprint",
 *     scopeId: example.id,
 * }));
 * const exampleGetPublishedVersion = Promise.all([exampleGetDefinition, exampleGetDefinition]).then(([exampleGetDefinition, exampleGetDefinition1]) => azure.blueprint.getPublishedVersion({
 *     scopeId: exampleGetDefinition.scopeId,
 *     blueprintName: exampleGetDefinition1.name,
 *     version: "v1.0.0",
 * }));
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "exampleRG-bp",
 *     location: "West Europe",
 *     tags: {
 *         Environment: "example",
 *     },
 * });
 * const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     name: "bp-user-example",
 * });
 * const operator = new azure.authorization.Assignment("operator", {
 *     scope: example.then(example => example.id),
 *     roleDefinitionName: "Blueprint Operator",
 *     principalId: exampleUserAssignedIdentity.principalId,
 * });
 * const owner = new azure.authorization.Assignment("owner", {
 *     scope: example.then(example => example.id),
 *     roleDefinitionName: "Owner",
 *     principalId: exampleUserAssignedIdentity.principalId,
 * });
 * const exampleAssignment = new azure.blueprint.Assignment("example", {
 *     name: "testAccBPAssignment",
 *     targetSubscriptionId: example.then(example => example.id),
 *     versionId: exampleGetPublishedVersion.then(exampleGetPublishedVersion => exampleGetPublishedVersion.id),
 *     location: exampleResourceGroup.location,
 *     lockMode: "AllResourcesDoNotDelete",
 *     lockExcludePrincipals: [current.then(current => current.objectId)],
 *     identity: {
 *         type: "UserAssigned",
 *         identityIds: [exampleUserAssignedIdentity.id],
 *     },
 *     resourceGroups: `    {
 *       \\"ResourceGroup\\": {
 *         \\"name\\": \\"exampleRG-bp\\"
 *       }
 *     }
 * `,
 *     parameterValues: `    {
 *       \\"allowedlocationsforresourcegroups_listOfAllowedLocations\\": {
 *         \\"value\\": [\\"westus\\", \\"westus2\\", \\"eastus\\", \\"centralus\\", \\"centraluseuap\\", \\"southcentralus\\", \\"northcentralus\\", \\"westcentralus\\", \\"eastus2\\", \\"eastus2euap\\", \\"brazilsouth\\", \\"brazilus\\", \\"northeurope\\", \\"westeurope\\", \\"eastasia\\", \\"southeastasia\\", \\"japanwest\\", \\"japaneast\\", \\"koreacentral\\", \\"koreasouth\\", \\"indiasouth\\", \\"indiawest\\", \\"indiacentral\\", \\"australiaeast\\", \\"australiasoutheast\\", \\"canadacentral\\", \\"canadaeast\\", \\"uknorth\\", \\"uksouth2\\", \\"uksouth\\", \\"ukwest\\", \\"francecentral\\", \\"francesouth\\", \\"australiacentral\\", \\"australiacentral2\\", \\"uaecentral\\", \\"uaenorth\\", \\"southafricanorth\\", \\"southafricawest\\", \\"switzerlandnorth\\", \\"switzerlandwest\\", \\"germanynorth\\", \\"germanywestcentral\\", \\"norwayeast\\", \\"norwaywest\\"]
 *       }
 *     }
 * `,
 * }, {
 *     dependsOn: [
 *         operator,
 *         owner,
 *     ],
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Blueprint` - 2018-11-01-preview
 *
 * ## Import
 *
 * Azure Blueprint Assignments can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:blueprint/assignment:Assignment example "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint"
 * ```
 */
class Assignment extends pulumi.CustomResource {
    /**
     * Get an existing Assignment 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 Assignment(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:blueprint/assignment:Assignment';
    /**
     * Returns true if the given object is an instance of Assignment.  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'] === Assignment.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["blueprintName"] = state?.blueprintName;
            resourceInputs["description"] = state?.description;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["identity"] = state?.identity;
            resourceInputs["location"] = state?.location;
            resourceInputs["lockExcludeActions"] = state?.lockExcludeActions;
            resourceInputs["lockExcludePrincipals"] = state?.lockExcludePrincipals;
            resourceInputs["lockMode"] = state?.lockMode;
            resourceInputs["name"] = state?.name;
            resourceInputs["parameterValues"] = state?.parameterValues;
            resourceInputs["resourceGroups"] = state?.resourceGroups;
            resourceInputs["targetSubscriptionId"] = state?.targetSubscriptionId;
            resourceInputs["type"] = state?.type;
            resourceInputs["versionId"] = state?.versionId;
        }
        else {
            const args = argsOrState;
            if (args?.identity === undefined && !opts.urn) {
                throw new Error("Missing required property 'identity'");
            }
            if (args?.targetSubscriptionId === undefined && !opts.urn) {
                throw new Error("Missing required property 'targetSubscriptionId'");
            }
            if (args?.versionId === undefined && !opts.urn) {
                throw new Error("Missing required property 'versionId'");
            }
            resourceInputs["identity"] = args?.identity;
            resourceInputs["location"] = args?.location;
            resourceInputs["lockExcludeActions"] = args?.lockExcludeActions;
            resourceInputs["lockExcludePrincipals"] = args?.lockExcludePrincipals;
            resourceInputs["lockMode"] = args?.lockMode;
            resourceInputs["name"] = args?.name;
            resourceInputs["parameterValues"] = args?.parameterValues;
            resourceInputs["resourceGroups"] = args?.resourceGroups;
            resourceInputs["targetSubscriptionId"] = args?.targetSubscriptionId;
            resourceInputs["versionId"] = args?.versionId;
            resourceInputs["blueprintName"] = undefined /*out*/;
            resourceInputs["description"] = undefined /*out*/;
            resourceInputs["displayName"] = undefined /*out*/;
            resourceInputs["type"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Assignment.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Assignment = Assignment;
//# sourceMappingURL=assignment.js.map