"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.IAMBinding = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Allows creation and management of a single binding within IAM policy for
 * an existing Google Cloud Platform folder.
 *
 * > **Note:** This resource _must not_ be used in conjunction with
 *    `gcp.folder.IAMPolicy` or they will fight over what your policy
 *    should be.
 *
 * > **Note:** On create, this resource will overwrite members of any existing roles.
 *     Use `pulumi import` and inspect the output to ensure
 *     your existing members are preserved.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const department1 = new gcp.organizations.Folder("department1", {
 *     displayName: "Department 1",
 *     parent: "organizations/1234567",
 * });
 * const admin = new gcp.folder.IAMBinding("admin", {
 *     folder: department1.name,
 *     role: "roles/editor",
 *     members: ["user:alice@gmail.com"],
 * });
 * ```
 *
 * ## Import
 *
 * IAM binding imports use space-delimited identifiers; first the resource in question and then the role.  These bindings can be imported using the `folder` and role, e.g.
 *
 * ```sh
 * $ pulumi import gcp:folder/iAMBinding:IAMBinding viewer "folder-name roles/viewer"
 * ```
 *
 * -> **Custom Roles**: If you're importing a IAM binding with a custom role, make sure to use the
 *
 *  full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
 */
class IAMBinding extends pulumi.CustomResource {
    /**
     * Get an existing IAMBinding 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 IAMBinding(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of IAMBinding.  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'] === IAMBinding.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["condition"] = state?.condition;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["folder"] = state?.folder;
            resourceInputs["members"] = state?.members;
            resourceInputs["role"] = state?.role;
        }
        else {
            const args = argsOrState;
            if (args?.folder === undefined && !opts.urn) {
                throw new Error("Missing required property 'folder'");
            }
            if (args?.members === undefined && !opts.urn) {
                throw new Error("Missing required property 'members'");
            }
            if (args?.role === undefined && !opts.urn) {
                throw new Error("Missing required property 'role'");
            }
            resourceInputs["condition"] = args?.condition;
            resourceInputs["folder"] = args?.folder;
            resourceInputs["members"] = args?.members;
            resourceInputs["role"] = args?.role;
            resourceInputs["etag"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(IAMBinding.__pulumiType, name, resourceInputs, opts);
    }
}
exports.IAMBinding = IAMBinding;
/** @internal */
IAMBinding.__pulumiType = 'gcp:folder/iAMBinding:IAMBinding';
//# sourceMappingURL=iambinding.js.map