All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.folder.kotlin.IAMBindingArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.folder.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.folder.IAMBindingArgs.builder
import com.pulumi.gcp.folder.kotlin.inputs.IAMBindingConditionArgs
import com.pulumi.gcp.folder.kotlin.inputs.IAMBindingConditionArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * 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"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * department1 = gcp.organizations.Folder("department1",
 *     display_name="Department 1",
 *     parent="organizations/1234567")
 * admin = gcp.folder.IAMBinding("admin",
 *     folder=department1.name,
 *     role="roles/editor",
 *     members=["user:alice@gmail.com"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var department1 = new Gcp.Organizations.Folder("department1", new()
 *     {
 *         DisplayName = "Department 1",
 *         Parent = "organizations/1234567",
 *     });
 *     var admin = new Gcp.Folder.IAMBinding("admin", new()
 *     {
 *         Folder = department1.Name,
 *         Role = "roles/editor",
 *         Members = new[]
 *         {
 *             "user:[email protected]",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/folder"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		department1, err := organizations.NewFolder(ctx, "department1", &organizations.FolderArgs{
 * 			DisplayName: pulumi.String("Department 1"),
 * 			Parent:      pulumi.String("organizations/1234567"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = folder.NewIAMBinding(ctx, "admin", &folder.IAMBindingArgs{
 * 			Folder: department1.Name,
 * 			Role:   pulumi.String("roles/editor"),
 * 			Members: pulumi.StringArray{
 * 				pulumi.String("user:[email protected]"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.organizations.Folder;
 * import com.pulumi.gcp.organizations.FolderArgs;
 * import com.pulumi.gcp.folder.IAMBinding;
 * import com.pulumi.gcp.folder.IAMBindingArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var department1 = new Folder("department1", FolderArgs.builder()
 *             .displayName("Department 1")
 *             .parent("organizations/1234567")
 *             .build());
 *         var admin = new IAMBinding("admin", IAMBindingArgs.builder()
 *             .folder(department1.name())
 *             .role("roles/editor")
 *             .members("user:[email protected]")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   department1:
 *     type: gcp:organizations:Folder
 *     properties:
 *       displayName: Department 1
 *       parent: organizations/1234567
 *   admin:
 *     type: gcp:folder:IAMBinding
 *     properties:
 *       folder: ${department1.name}
 *       role: roles/editor
 *       members:
 *         - user:[email protected]
 * ```
 * 
 * ## 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`.
 * @property condition
 * @property folder The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.
 * @property members An array of identities that will be granted the privilege in the `role`.
 * Each entry can have one of the following values:
 * * **user:{emailid}**: An email address that is associated with a specific Google account. For example, [email protected].
 * * **serviceAccount:{emailid}**: An email address that represents a service account. For example, [email protected].
 * * **group:{emailid}**: An email address that represents a Google group. For example, [email protected].
 * * **domain:{domain}**: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.
 * * For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding
 * @property role The role that should be applied. Only one
 * `gcp.folder.IAMBinding` can be used per role. Note that custom roles must be of the format
 * `[projects|organizations]/{parent-name}/roles/{role-name}`.
 */
public data class IAMBindingArgs(
    public val condition: Output? = null,
    public val folder: Output? = null,
    public val members: Output>? = null,
    public val role: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.folder.IAMBindingArgs =
        com.pulumi.gcp.folder.IAMBindingArgs.builder()
            .condition(condition?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .folder(folder?.applyValue({ args0 -> args0 }))
            .members(members?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .role(role?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [IAMBindingArgs].
 */
@PulumiTagMarker
public class IAMBindingArgsBuilder internal constructor() {
    private var condition: Output? = null

    private var folder: Output? = null

    private var members: Output>? = null

    private var role: Output? = null

    /**
     * @param value
     */
    @JvmName("pcyuxsuccpeefflw")
    public suspend fun condition(`value`: Output) {
        this.condition = value
    }

    /**
     * @param value The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.
     */
    @JvmName("kyxpavbvutmrhkfk")
    public suspend fun folder(`value`: Output) {
        this.folder = value
    }

    /**
     * @param value An array of identities that will be granted the privilege in the `role`.
     * Each entry can have one of the following values:
     * * **user:{emailid}**: An email address that is associated with a specific Google account. For example, [email protected].
     * * **serviceAccount:{emailid}**: An email address that represents a service account. For example, [email protected].
     * * **group:{emailid}**: An email address that represents a Google group. For example, [email protected].
     * * **domain:{domain}**: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.
     * * For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding
     */
    @JvmName("pabdspjigxsowxxq")
    public suspend fun members(`value`: Output>) {
        this.members = value
    }

    @JvmName("pbngdxmbnpwxkqxp")
    public suspend fun members(vararg values: Output) {
        this.members = Output.all(values.asList())
    }

    /**
     * @param values An array of identities that will be granted the privilege in the `role`.
     * Each entry can have one of the following values:
     * * **user:{emailid}**: An email address that is associated with a specific Google account. For example, [email protected].
     * * **serviceAccount:{emailid}**: An email address that represents a service account. For example, [email protected].
     * * **group:{emailid}**: An email address that represents a Google group. For example, [email protected].
     * * **domain:{domain}**: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.
     * * For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding
     */
    @JvmName("jxktrjpxfcrbbndl")
    public suspend fun members(values: List>) {
        this.members = Output.all(values)
    }

    /**
     * @param value The role that should be applied. Only one
     * `gcp.folder.IAMBinding` can be used per role. Note that custom roles must be of the format
     * `[projects|organizations]/{parent-name}/roles/{role-name}`.
     */
    @JvmName("nsdbytytpfdiebrd")
    public suspend fun role(`value`: Output) {
        this.role = value
    }

    /**
     * @param value
     */
    @JvmName("drdesousaftgebug")
    public suspend fun condition(`value`: IAMBindingConditionArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.condition = mapped
    }

    /**
     * @param argument
     */
    @JvmName("hgbncsmverblaygl")
    public suspend fun condition(argument: suspend IAMBindingConditionArgsBuilder.() -> Unit) {
        val toBeMapped = IAMBindingConditionArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.condition = mapped
    }

    /**
     * @param value The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.
     */
    @JvmName("ujxlgrbjwpnlposy")
    public suspend fun folder(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.folder = mapped
    }

    /**
     * @param value An array of identities that will be granted the privilege in the `role`.
     * Each entry can have one of the following values:
     * * **user:{emailid}**: An email address that is associated with a specific Google account. For example, [email protected].
     * * **serviceAccount:{emailid}**: An email address that represents a service account. For example, [email protected].
     * * **group:{emailid}**: An email address that represents a Google group. For example, [email protected].
     * * **domain:{domain}**: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.
     * * For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding
     */
    @JvmName("vpolnojgqydwbume")
    public suspend fun members(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.members = mapped
    }

    /**
     * @param values An array of identities that will be granted the privilege in the `role`.
     * Each entry can have one of the following values:
     * * **user:{emailid}**: An email address that is associated with a specific Google account. For example, [email protected].
     * * **serviceAccount:{emailid}**: An email address that represents a service account. For example, [email protected].
     * * **group:{emailid}**: An email address that represents a Google group. For example, [email protected].
     * * **domain:{domain}**: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.
     * * For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding
     */
    @JvmName("gyafmunqtvgxwdox")
    public suspend fun members(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.members = mapped
    }

    /**
     * @param value The role that should be applied. Only one
     * `gcp.folder.IAMBinding` can be used per role. Note that custom roles must be of the format
     * `[projects|organizations]/{parent-name}/roles/{role-name}`.
     */
    @JvmName("makbptfrjpvdnnhw")
    public suspend fun role(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.role = mapped
    }

    internal fun build(): IAMBindingArgs = IAMBindingArgs(
        condition = condition,
        folder = folder,
        members = members,
        role = role,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy