com.pulumi.gcp.organizations.kotlin.IAMBindingArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.organizations.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.organizations.IAMBindingArgs.builder
import com.pulumi.gcp.organizations.kotlin.inputs.IAMBindingConditionArgs
import com.pulumi.gcp.organizations.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 Organization.
* > **Note:** This resource __must not__ be used in conjunction with
* `gcp.organizations.IAMMember` for the __same role__ 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 binding = new gcp.organizations.IAMBinding("binding", {
* orgId: "123456789",
* role: "roles/browser",
* members: ["user:alice@gmail.com"],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* binding = gcp.organizations.IAMBinding("binding",
* org_id="123456789",
* role="roles/browser",
* members=["user:alice@gmail.com"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var binding = new Gcp.Organizations.IAMBinding("binding", new()
* {
* OrgId = "123456789",
* Role = "roles/browser",
* Members = new[]
* {
* "user:[email protected]",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "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 {
* _, err := organizations.NewIAMBinding(ctx, "binding", &organizations.IAMBindingArgs{
* OrgId: pulumi.String("123456789"),
* Role: pulumi.String("roles/browser"),
* 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.IAMBinding;
* import com.pulumi.gcp.organizations.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 binding = new IAMBinding("binding", IAMBindingArgs.builder()
* .orgId("123456789")
* .role("roles/browser")
* .members("user:[email protected]")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* binding:
* type: gcp:organizations:IAMBinding
* properties:
* orgId: '123456789'
* role: roles/browser
* 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 `org_id` and role, e.g.
* ```sh
* $ pulumi import gcp:organizations/iAMBinding:IAMBinding my_org "your-org-id roles/viewer"
* ```
* -> **Custom Roles**: If you're importing a IAM resource 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 members A list of users that the role should apply to. For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding
* @property orgId The numeric ID of the organization in which you want to create a custom role.
* @property role The role that should be applied. Only one
* `gcp.organizations.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 members: Output>? = null,
public val orgId: Output? = null,
public val role: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.organizations.IAMBindingArgs =
com.pulumi.gcp.organizations.IAMBindingArgs.builder()
.condition(condition?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.members(members?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.orgId(orgId?.applyValue({ args0 -> args0 }))
.role(role?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [IAMBindingArgs].
*/
@PulumiTagMarker
public class IAMBindingArgsBuilder internal constructor() {
private var condition: Output? = null
private var members: Output>? = null
private var orgId: Output? = null
private var role: Output? = null
/**
* @param value
*/
@JvmName("tguvknsoaohwxvsj")
public suspend fun condition(`value`: Output) {
this.condition = value
}
/**
* @param value A list of users that the role should apply to. For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding
*/
@JvmName("friqygcndwyjydtd")
public suspend fun members(`value`: Output>) {
this.members = value
}
@JvmName("bhytfjuhsswfqsdy")
public suspend fun members(vararg values: Output) {
this.members = Output.all(values.asList())
}
/**
* @param values A list of users that the role should apply to. For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding
*/
@JvmName("vxshgommhvdnjlsw")
public suspend fun members(values: List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy