"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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.IAMCustomRole = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Allows management of a customized Cloud IAM project role. For more information see
 * [the official documentation](https://cloud.google.com/iam/docs/understanding-custom-roles)
 * and
 * [API](https://cloud.google.com/iam/reference/rest/v1/projects.roles).
 *
 * > **Warning:** Note that custom roles in GCP have the concept of a soft-delete. There are two issues that may arise
 *  from this and how roles are propagated. 1) creating a role may involve undeleting and then updating a role with the
 *  same name, possibly causing confusing behavior between undelete and update. 2) A deleted role is permanently deleted
 *  after 7 days, but it can take up to 30 more days (i.e. between 7 and 37 days after deletion) before the role name is
 *  made available again. This means a deleted role that has been deleted for more than 7 days cannot be changed at all
 *  by the provider, and new roles cannot share that name.
 *
 * ## Example Usage
 *
 * This snippet creates a customized IAM role.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const my_custom_role = new gcp.projects.IAMCustomRole("my-custom-role", {
 *     roleId: "myCustomRole",
 *     title: "My Custom Role",
 *     description: "A description",
 *     permissions: [
 *         "iam.roles.list",
 *         "iam.roles.create",
 *         "iam.roles.delete",
 *     ],
 * });
 * ```
 *
 * ## Import
 *
 * Custom Roles can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/roles/{{role_id}}`
 *
 * * `{{project}}/{{role_id}}`
 *
 * * `{{role_id}}`
 *
 * When using the `pulumi import` command, Custom Roles can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:projects/iAMCustomRole:IAMCustomRole default projects/{{project}}/roles/{{role_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:projects/iAMCustomRole:IAMCustomRole default {{project}}/{{role_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:projects/iAMCustomRole:IAMCustomRole default {{role_id}}
 * ```
 */
class IAMCustomRole extends pulumi.CustomResource {
    /**
     * Get an existing IAMCustomRole 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 IAMCustomRole(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of IAMCustomRole.  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'] === IAMCustomRole.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["deleted"] = state?.deleted;
            resourceInputs["description"] = state?.description;
            resourceInputs["name"] = state?.name;
            resourceInputs["permissions"] = state?.permissions;
            resourceInputs["project"] = state?.project;
            resourceInputs["roleId"] = state?.roleId;
            resourceInputs["stage"] = state?.stage;
            resourceInputs["title"] = state?.title;
        }
        else {
            const args = argsOrState;
            if (args?.permissions === undefined && !opts.urn) {
                throw new Error("Missing required property 'permissions'");
            }
            if (args?.title === undefined && !opts.urn) {
                throw new Error("Missing required property 'title'");
            }
            resourceInputs["description"] = args?.description;
            resourceInputs["permissions"] = args?.permissions;
            resourceInputs["project"] = args?.project;
            resourceInputs["roleId"] = args?.roleId;
            resourceInputs["stage"] = args?.stage;
            resourceInputs["title"] = args?.title;
            resourceInputs["deleted"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(IAMCustomRole.__pulumiType, name, resourceInputs, opts);
    }
}
exports.IAMCustomRole = IAMCustomRole;
/** @internal */
IAMCustomRole.__pulumiType = 'gcp:projects/iAMCustomRole:IAMCustomRole';
//# sourceMappingURL=iamcustomRole.js.map