"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.EligibleRoleAssignment = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a PIM Eligible Role Assignment.
 *
 * ## Example Usage
 *
 * ### Subscription)
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as time from "@pulumiverse/time";
 *
 * const primary = azure.core.getSubscription({});
 * const example = azure.core.getClientConfig({});
 * const exampleGetRoleDefinition = azure.authorization.getRoleDefinition({
 *     name: "Reader",
 * });
 * const exampleStatic = new time.Static("example", {});
 * const exampleEligibleRoleAssignment = new azure.pim.EligibleRoleAssignment("example", {
 *     scope: primary.then(primary => primary.id),
 *     roleDefinitionId: Promise.all([primary, exampleGetRoleDefinition]).then(([primary, exampleGetRoleDefinition]) => `${primary.id}${exampleGetRoleDefinition.id}`),
 *     principalId: example.then(example => example.objectId),
 *     schedule: {
 *         startDateTime: exampleStatic.rfc3339,
 *         expiration: {
 *             durationHours: 8,
 *         },
 *     },
 *     justification: "Expiration Duration Set",
 *     ticket: {
 *         number: "1",
 *         system: "example ticket system",
 *     },
 * });
 * ```
 *
 * ### Management Group)
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as time from "@pulumiverse/time";
 *
 * const example = azure.core.getClientConfig({});
 * const exampleGetRoleDefinition = azure.authorization.getRoleDefinition({
 *     name: "Reader",
 * });
 * const exampleGroup = new azure.management.Group("example", {name: "Example-Management-Group"});
 * const exampleStatic = new time.Static("example", {});
 * const exampleEligibleRoleAssignment = new azure.pim.EligibleRoleAssignment("example", {
 *     scope: exampleGroup.id,
 *     roleDefinitionId: exampleGetRoleDefinition.then(exampleGetRoleDefinition => exampleGetRoleDefinition.id),
 *     principalId: example.then(example => example.objectId),
 *     schedule: {
 *         startDateTime: exampleStatic.rfc3339,
 *         expiration: {
 *             durationHours: 8,
 *         },
 *     },
 *     justification: "Expiration Duration Set",
 *     ticket: {
 *         number: "1",
 *         system: "example ticket system",
 *     },
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Authorization` - 2020-10-01
 *
 * ## Import
 *
 * PIM Eligible Role Assignments can be imported using the following composite resource ID, e.g.
 *
 * ```sh
 * $ pulumi import azure:pim/eligibleRoleAssignment:EligibleRoleAssignment example /subscriptions/00000000-0000-0000-0000-000000000000|/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/00000000-0000-0000-0000-000000000000|00000000-0000-0000-0000-000000000000
 * ```
 *
 * > **Note:** This ID is specific to Terraform - and is of the format `{scope}|{roleDefinitionId}|{principalId}`, where the first segment is the scope of the role assignment, the second segment is the role definition ID, and the last segment is the principal object ID.
 */
class EligibleRoleAssignment extends pulumi.CustomResource {
    /**
     * Get an existing EligibleRoleAssignment 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 EligibleRoleAssignment(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:pim/eligibleRoleAssignment:EligibleRoleAssignment';
    /**
     * Returns true if the given object is an instance of EligibleRoleAssignment.  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'] === EligibleRoleAssignment.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["condition"] = state?.condition;
            resourceInputs["conditionVersion"] = state?.conditionVersion;
            resourceInputs["justification"] = state?.justification;
            resourceInputs["principalId"] = state?.principalId;
            resourceInputs["principalType"] = state?.principalType;
            resourceInputs["roleDefinitionId"] = state?.roleDefinitionId;
            resourceInputs["schedule"] = state?.schedule;
            resourceInputs["scope"] = state?.scope;
            resourceInputs["ticket"] = state?.ticket;
        }
        else {
            const args = argsOrState;
            if (args?.principalId === undefined && !opts.urn) {
                throw new Error("Missing required property 'principalId'");
            }
            if (args?.roleDefinitionId === undefined && !opts.urn) {
                throw new Error("Missing required property 'roleDefinitionId'");
            }
            if (args?.scope === undefined && !opts.urn) {
                throw new Error("Missing required property 'scope'");
            }
            resourceInputs["condition"] = args?.condition;
            resourceInputs["conditionVersion"] = args?.conditionVersion;
            resourceInputs["justification"] = args?.justification;
            resourceInputs["principalId"] = args?.principalId;
            resourceInputs["roleDefinitionId"] = args?.roleDefinitionId;
            resourceInputs["schedule"] = args?.schedule;
            resourceInputs["scope"] = args?.scope;
            resourceInputs["ticket"] = args?.ticket;
            resourceInputs["principalType"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(EligibleRoleAssignment.__pulumiType, name, resourceInputs, opts);
    }
}
exports.EligibleRoleAssignment = EligibleRoleAssignment;
//# sourceMappingURL=eligibleRoleAssignment.js.map