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

com.pulumi.gcp.gkehub.kotlin.MembershipRbacRoleBindingArgs.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.gkehub.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.gkehub.MembershipRbacRoleBindingArgs.builder
import com.pulumi.gcp.gkehub.kotlin.inputs.MembershipRbacRoleBindingRoleArgs
import com.pulumi.gcp.gkehub.kotlin.inputs.MembershipRbacRoleBindingRoleArgsBuilder
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.jvm.JvmName

/**
 * ## Example Usage
 * ### Gkehub Membership Rbac Role Binding Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const primary = new gcp.container.Cluster("primary", {
 *     name: "basic-cluster",
 *     location: "us-central1-a",
 *     initialNodeCount: 1,
 *     deletionProtection: true,
 *     network: "default",
 *     subnetwork: "default",
 * });
 * const membership = new gcp.gkehub.Membership("membership", {
 *     membershipId: "tf-test-membership_16511",
 *     endpoint: {
 *         gkeCluster: {
 *             resourceLink: pulumi.interpolate`//container.googleapis.com/${primary.id}`,
 *         },
 *     },
 * });
 * const project = gcp.organizations.getProject({});
 * const membershipRbacRoleBinding = new gcp.gkehub.MembershipRbacRoleBinding("membership_rbac_role_binding", {
 *     membershipRbacRoleBindingId: "tf-test-membership-rbac-role-binding_8493",
 *     membershipId: membership.membershipId,
 *     user: project.then(project => `service-${project.number}@gcp-sa-anthossupport.iam.gserviceaccount.com`),
 *     role: {
 *         predefinedRole: "ANTHOS_SUPPORT",
 *     },
 *     location: "global",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * primary = gcp.container.Cluster("primary",
 *     name="basic-cluster",
 *     location="us-central1-a",
 *     initial_node_count=1,
 *     deletion_protection=True,
 *     network="default",
 *     subnetwork="default")
 * membership = gcp.gkehub.Membership("membership",
 *     membership_id="tf-test-membership_16511",
 *     endpoint=gcp.gkehub.MembershipEndpointArgs(
 *         gke_cluster=gcp.gkehub.MembershipEndpointGkeClusterArgs(
 *             resource_link=primary.id.apply(lambda id: f"//container.googleapis.com/{id}"),
 *         ),
 *     ))
 * project = gcp.organizations.get_project()
 * membership_rbac_role_binding = gcp.gkehub.MembershipRbacRoleBinding("membership_rbac_role_binding",
 *     membership_rbac_role_binding_id="tf-test-membership-rbac-role-binding_8493",
 *     membership_id=membership.membership_id,
 *     user=f"service-{project.number}@gcp-sa-anthossupport.iam.gserviceaccount.com",
 *     role=gcp.gkehub.MembershipRbacRoleBindingRoleArgs(
 *         predefined_role="ANTHOS_SUPPORT",
 *     ),
 *     location="global")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var primary = new Gcp.Container.Cluster("primary", new()
 *     {
 *         Name = "basic-cluster",
 *         Location = "us-central1-a",
 *         InitialNodeCount = 1,
 *         DeletionProtection = true,
 *         Network = "default",
 *         Subnetwork = "default",
 *     });
 *     var membership = new Gcp.GkeHub.Membership("membership", new()
 *     {
 *         MembershipId = "tf-test-membership_16511",
 *         Endpoint = new Gcp.GkeHub.Inputs.MembershipEndpointArgs
 *         {
 *             GkeCluster = new Gcp.GkeHub.Inputs.MembershipEndpointGkeClusterArgs
 *             {
 *                 ResourceLink = primary.Id.Apply(id => $"//container.googleapis.com/{id}"),
 *             },
 *         },
 *     });
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var membershipRbacRoleBinding = new Gcp.GkeHub.MembershipRbacRoleBinding("membership_rbac_role_binding", new()
 *     {
 *         MembershipRbacRoleBindingId = "tf-test-membership-rbac-role-binding_8493",
 *         MembershipId = membership.MembershipId,
 *         User = $"service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-anthossupport.iam.gserviceaccount.com",
 *         Role = new Gcp.GkeHub.Inputs.MembershipRbacRoleBindingRoleArgs
 *         {
 *             PredefinedRole = "ANTHOS_SUPPORT",
 *         },
 *         Location = "global",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkehub"
 * 	"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 {
 * 		primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
 * 			Name:               pulumi.String("basic-cluster"),
 * 			Location:           pulumi.String("us-central1-a"),
 * 			InitialNodeCount:   pulumi.Int(1),
 * 			DeletionProtection: pulumi.Bool(true),
 * 			Network:            pulumi.String("default"),
 * 			Subnetwork:         pulumi.String("default"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		membership, err := gkehub.NewMembership(ctx, "membership", &gkehub.MembershipArgs{
 * 			MembershipId: pulumi.String("tf-test-membership_16511"),
 * 			Endpoint: &gkehub.MembershipEndpointArgs{
 * 				GkeCluster: &gkehub.MembershipEndpointGkeClusterArgs{
 * 					ResourceLink: primary.ID().ApplyT(func(id string) (string, error) {
 * 						return fmt.Sprintf("//container.googleapis.com/%v", id), nil
 * 					}).(pulumi.StringOutput),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = gkehub.NewMembershipRbacRoleBinding(ctx, "membership_rbac_role_binding", &gkehub.MembershipRbacRoleBindingArgs{
 * 			MembershipRbacRoleBindingId: pulumi.String("tf-test-membership-rbac-role-binding_8493"),
 * 			MembershipId:                membership.MembershipId,
 * 			User:                        pulumi.String(fmt.Sprintf("service-%[email protected]", project.Number)),
 * 			Role: &gkehub.MembershipRbacRoleBindingRoleArgs{
 * 				PredefinedRole: pulumi.String("ANTHOS_SUPPORT"),
 * 			},
 * 			Location: pulumi.String("global"),
 * 		})
 * 		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.container.Cluster;
 * import com.pulumi.gcp.container.ClusterArgs;
 * import com.pulumi.gcp.gkehub.Membership;
 * import com.pulumi.gcp.gkehub.MembershipArgs;
 * import com.pulumi.gcp.gkehub.inputs.MembershipEndpointArgs;
 * import com.pulumi.gcp.gkehub.inputs.MembershipEndpointGkeClusterArgs;
 * import com.pulumi.gcp.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.gkehub.MembershipRbacRoleBinding;
 * import com.pulumi.gcp.gkehub.MembershipRbacRoleBindingArgs;
 * import com.pulumi.gcp.gkehub.inputs.MembershipRbacRoleBindingRoleArgs;
 * 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 primary = new Cluster("primary", ClusterArgs.builder()
 *             .name("basic-cluster")
 *             .location("us-central1-a")
 *             .initialNodeCount(1)
 *             .deletionProtection("true")
 *             .network("default")
 *             .subnetwork("default")
 *             .build());
 *         var membership = new Membership("membership", MembershipArgs.builder()
 *             .membershipId("tf-test-membership_16511")
 *             .endpoint(MembershipEndpointArgs.builder()
 *                 .gkeCluster(MembershipEndpointGkeClusterArgs.builder()
 *                     .resourceLink(primary.id().applyValue(id -> String.format("//container.googleapis.com/%s", id)))
 *                     .build())
 *                 .build())
 *             .build());
 *         final var project = OrganizationsFunctions.getProject();
 *         var membershipRbacRoleBinding = new MembershipRbacRoleBinding("membershipRbacRoleBinding", MembershipRbacRoleBindingArgs.builder()
 *             .membershipRbacRoleBindingId("tf-test-membership-rbac-role-binding_8493")
 *             .membershipId(membership.membershipId())
 *             .user(String.format("service-%[email protected]", project.applyValue(getProjectResult -> getProjectResult.number())))
 *             .role(MembershipRbacRoleBindingRoleArgs.builder()
 *                 .predefinedRole("ANTHOS_SUPPORT")
 *                 .build())
 *             .location("global")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   primary:
 *     type: gcp:container:Cluster
 *     properties:
 *       name: basic-cluster
 *       location: us-central1-a
 *       initialNodeCount: 1
 *       deletionProtection: 'true'
 *       network: default
 *       subnetwork: default
 *   membership:
 *     type: gcp:gkehub:Membership
 *     properties:
 *       membershipId: tf-test-membership_16511
 *       endpoint:
 *         gkeCluster:
 *           resourceLink: //container.googleapis.com/${primary.id}
 *   membershipRbacRoleBinding:
 *     type: gcp:gkehub:MembershipRbacRoleBinding
 *     name: membership_rbac_role_binding
 *     properties:
 *       membershipRbacRoleBindingId: tf-test-membership-rbac-role-binding_8493
 *       membershipId: ${membership.membershipId}
 *       user: service-${project.number}@gcp-sa-anthossupport.iam.gserviceaccount.com
 *       role:
 *         predefinedRole: ANTHOS_SUPPORT
 *       location: global
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * MembershipRBACRoleBinding can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/rbacrolebindings/{{membership_rbac_role_binding_id}}`
 * * `{{project}}/{{location}}/{{membership_id}}/{{membership_rbac_role_binding_id}}`
 * * `{{location}}/{{membership_id}}/{{membership_rbac_role_binding_id}}`
 * When using the `pulumi import` command, MembershipRBACRoleBinding can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:gkehub/membershipRbacRoleBinding:MembershipRbacRoleBinding default projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/rbacrolebindings/{{membership_rbac_role_binding_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:gkehub/membershipRbacRoleBinding:MembershipRbacRoleBinding default {{project}}/{{location}}/{{membership_id}}/{{membership_rbac_role_binding_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:gkehub/membershipRbacRoleBinding:MembershipRbacRoleBinding default {{location}}/{{membership_id}}/{{membership_rbac_role_binding_id}}
 * ```
 * @property location Location of the Membership
 * @property membershipId Id of the membership
 * @property membershipRbacRoleBindingId The client-provided identifier of the RBAC Role Binding.
 * @property project
 * @property role Role to bind to the principal.
 * Structure is documented below.
 * @property user Principal that is be authorized in the cluster (at least of one the oneof
 * is required). Updating one will unset the other automatically.
 * user is the name of the user as seen by the kubernetes cluster, example
 * "alice" or "[email protected]"
 */
public data class MembershipRbacRoleBindingArgs(
    public val location: Output? = null,
    public val membershipId: Output? = null,
    public val membershipRbacRoleBindingId: Output? = null,
    public val project: Output? = null,
    public val role: Output? = null,
    public val user: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.gkehub.MembershipRbacRoleBindingArgs =
        com.pulumi.gcp.gkehub.MembershipRbacRoleBindingArgs.builder()
            .location(location?.applyValue({ args0 -> args0 }))
            .membershipId(membershipId?.applyValue({ args0 -> args0 }))
            .membershipRbacRoleBindingId(membershipRbacRoleBindingId?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .role(role?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .user(user?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [MembershipRbacRoleBindingArgs].
 */
@PulumiTagMarker
public class MembershipRbacRoleBindingArgsBuilder internal constructor() {
    private var location: Output? = null

    private var membershipId: Output? = null

    private var membershipRbacRoleBindingId: Output? = null

    private var project: Output? = null

    private var role: Output? = null

    private var user: Output? = null

    /**
     * @param value Location of the Membership
     */
    @JvmName("khypvbkjgochcutq")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value Id of the membership
     */
    @JvmName("eirtwiqjqstadaia")
    public suspend fun membershipId(`value`: Output) {
        this.membershipId = value
    }

    /**
     * @param value The client-provided identifier of the RBAC Role Binding.
     */
    @JvmName("gcxbprwyvdsnifii")
    public suspend fun membershipRbacRoleBindingId(`value`: Output) {
        this.membershipRbacRoleBindingId = value
    }

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

    /**
     * @param value Role to bind to the principal.
     * Structure is documented below.
     */
    @JvmName("inwmhudonwnmyqin")
    public suspend fun role(`value`: Output) {
        this.role = value
    }

    /**
     * @param value Principal that is be authorized in the cluster (at least of one the oneof
     * is required). Updating one will unset the other automatically.
     * user is the name of the user as seen by the kubernetes cluster, example
     * "alice" or "[email protected]"
     */
    @JvmName("wywpcxxqfgnjuaue")
    public suspend fun user(`value`: Output) {
        this.user = value
    }

    /**
     * @param value Location of the Membership
     */
    @JvmName("bskcvstearotabee")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value Id of the membership
     */
    @JvmName("ajmcksadvdltxuua")
    public suspend fun membershipId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.membershipId = mapped
    }

    /**
     * @param value The client-provided identifier of the RBAC Role Binding.
     */
    @JvmName("stdsunhonoogwyjw")
    public suspend fun membershipRbacRoleBindingId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.membershipRbacRoleBindingId = mapped
    }

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

    /**
     * @param value Role to bind to the principal.
     * Structure is documented below.
     */
    @JvmName("irhdhjvualiriamp")
    public suspend fun role(`value`: MembershipRbacRoleBindingRoleArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.role = mapped
    }

    /**
     * @param argument Role to bind to the principal.
     * Structure is documented below.
     */
    @JvmName("txnlgrxrcpuobqrs")
    public suspend fun role(argument: suspend MembershipRbacRoleBindingRoleArgsBuilder.() -> Unit) {
        val toBeMapped = MembershipRbacRoleBindingRoleArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.role = mapped
    }

    /**
     * @param value Principal that is be authorized in the cluster (at least of one the oneof
     * is required). Updating one will unset the other automatically.
     * user is the name of the user as seen by the kubernetes cluster, example
     * "alice" or "[email protected]"
     */
    @JvmName("shfdniqwesngawvs")
    public suspend fun user(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.user = mapped
    }

    internal fun build(): MembershipRbacRoleBindingArgs = MembershipRbacRoleBindingArgs(
        location = location,
        membershipId = membershipId,
        membershipRbacRoleBindingId = membershipRbacRoleBindingId,
        project = project,
        role = role,
        user = user,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy