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

com.pulumi.gcp.gkehub.kotlin.ScopeRbacRoleBinding.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.gkehub.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.gkehub.kotlin.outputs.ScopeRbacRoleBindingRole
import com.pulumi.gcp.gkehub.kotlin.outputs.ScopeRbacRoleBindingState
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.gkehub.kotlin.outputs.ScopeRbacRoleBindingRole.Companion.toKotlin as scopeRbacRoleBindingRoleToKotlin
import com.pulumi.gcp.gkehub.kotlin.outputs.ScopeRbacRoleBindingState.Companion.toKotlin as scopeRbacRoleBindingStateToKotlin

/**
 * Builder for [ScopeRbacRoleBinding].
 */
@PulumiTagMarker
public class ScopeRbacRoleBindingResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ScopeRbacRoleBindingArgs = ScopeRbacRoleBindingArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend ScopeRbacRoleBindingArgsBuilder.() -> Unit) {
        val builder = ScopeRbacRoleBindingArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): ScopeRbacRoleBinding {
        val builtJavaResource = com.pulumi.gcp.gkehub.ScopeRbacRoleBinding(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ScopeRbacRoleBinding(builtJavaResource)
    }
}

/**
 * RBACRoleBinding represents a rbacrolebinding across the Fleet.
 * To get more information about ScopeRBACRoleBinding, see:
 * * [API documentation](https://cloud.google.com/anthos/fleet-management/docs/reference/rest/v1/projects.locations.scopes.rbacrolebindings)
 * * How-to Guides
 *     * [Registering a Cluster](https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster#register_cluster)
 * ## Example Usage
 * ### Gkehub Scope Rbac Role Binding Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const scope = new gcp.gkehub.Scope("scope", {scopeId: "tf-test-scope_41819"});
 * const scopeRbacRoleBinding = new gcp.gkehub.ScopeRbacRoleBinding("scope_rbac_role_binding", {
 *     scopeRbacRoleBindingId: "tf-test-scope-rbac-role-binding_75092",
 *     scopeId: scope.scopeId,
 *     user: "[email protected]",
 *     role: {
 *         predefinedRole: "ADMIN",
 *     },
 *     labels: {
 *         key: "value",
 *     },
 * }, {
 *     dependsOn: [scope],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * scope = gcp.gkehub.Scope("scope", scope_id="tf-test-scope_41819")
 * scope_rbac_role_binding = gcp.gkehub.ScopeRbacRoleBinding("scope_rbac_role_binding",
 *     scope_rbac_role_binding_id="tf-test-scope-rbac-role-binding_75092",
 *     scope_id=scope.scope_id,
 *     user="[email protected]",
 *     role={
 *         "predefined_role": "ADMIN",
 *     },
 *     labels={
 *         "key": "value",
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[scope]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var scope = new Gcp.GkeHub.Scope("scope", new()
 *     {
 *         ScopeId = "tf-test-scope_41819",
 *     });
 *     var scopeRbacRoleBinding = new Gcp.GkeHub.ScopeRbacRoleBinding("scope_rbac_role_binding", new()
 *     {
 *         ScopeRbacRoleBindingId = "tf-test-scope-rbac-role-binding_75092",
 *         ScopeId = scope.ScopeId,
 *         User = "[email protected]",
 *         Role = new Gcp.GkeHub.Inputs.ScopeRbacRoleBindingRoleArgs
 *         {
 *             PredefinedRole = "ADMIN",
 *         },
 *         Labels =
 *         {
 *             { "key", "value" },
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             scope,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkehub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		scope, err := gkehub.NewScope(ctx, "scope", &gkehub.ScopeArgs{
 * 			ScopeId: pulumi.String("tf-test-scope_41819"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = gkehub.NewScopeRbacRoleBinding(ctx, "scope_rbac_role_binding", &gkehub.ScopeRbacRoleBindingArgs{
 * 			ScopeRbacRoleBindingId: pulumi.String("tf-test-scope-rbac-role-binding_75092"),
 * 			ScopeId:                scope.ScopeId,
 * 			User:                   pulumi.String("[email protected]"),
 * 			Role: &gkehub.ScopeRbacRoleBindingRoleArgs{
 * 				PredefinedRole: pulumi.String("ADMIN"),
 * 			},
 * 			Labels: pulumi.StringMap{
 * 				"key": pulumi.String("value"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			scope,
 * 		}))
 * 		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.gkehub.Scope;
 * import com.pulumi.gcp.gkehub.ScopeArgs;
 * import com.pulumi.gcp.gkehub.ScopeRbacRoleBinding;
 * import com.pulumi.gcp.gkehub.ScopeRbacRoleBindingArgs;
 * import com.pulumi.gcp.gkehub.inputs.ScopeRbacRoleBindingRoleArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 scope = new Scope("scope", ScopeArgs.builder()
 *             .scopeId("tf-test-scope_41819")
 *             .build());
 *         var scopeRbacRoleBinding = new ScopeRbacRoleBinding("scopeRbacRoleBinding", ScopeRbacRoleBindingArgs.builder()
 *             .scopeRbacRoleBindingId("tf-test-scope-rbac-role-binding_75092")
 *             .scopeId(scope.scopeId())
 *             .user("[email protected]")
 *             .role(ScopeRbacRoleBindingRoleArgs.builder()
 *                 .predefinedRole("ADMIN")
 *                 .build())
 *             .labels(Map.of("key", "value"))
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(scope)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   scope:
 *     type: gcp:gkehub:Scope
 *     properties:
 *       scopeId: tf-test-scope_41819
 *   scopeRbacRoleBinding:
 *     type: gcp:gkehub:ScopeRbacRoleBinding
 *     name: scope_rbac_role_binding
 *     properties:
 *       scopeRbacRoleBindingId: tf-test-scope-rbac-role-binding_75092
 *       scopeId: ${scope.scopeId}
 *       user: [email protected]
 *       role:
 *         predefinedRole: ADMIN
 *       labels:
 *         key: value
 *     options:
 *       dependson:
 *         - ${scope}
 * ```
 * 
 * ## Import
 * ScopeRBACRoleBinding can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/global/scopes/{{scope_id}}/rbacrolebindings/{{scope_rbac_role_binding_id}}`
 * * `{{project}}/{{scope_id}}/{{scope_rbac_role_binding_id}}`
 * * `{{scope_id}}/{{scope_rbac_role_binding_id}}`
 * When using the `pulumi import` command, ScopeRBACRoleBinding can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:gkehub/scopeRbacRoleBinding:ScopeRbacRoleBinding default projects/{{project}}/locations/global/scopes/{{scope_id}}/rbacrolebindings/{{scope_rbac_role_binding_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:gkehub/scopeRbacRoleBinding:ScopeRbacRoleBinding default {{project}}/{{scope_id}}/{{scope_rbac_role_binding_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:gkehub/scopeRbacRoleBinding:ScopeRbacRoleBinding default {{scope_id}}/{{scope_rbac_role_binding_id}}
 * ```
 */
public class ScopeRbacRoleBinding internal constructor(
    override val javaResource: com.pulumi.gcp.gkehub.ScopeRbacRoleBinding,
) : KotlinCustomResource(javaResource, ScopeRbacRoleBindingMapper) {
    /**
     * Time the RBAC Role Binding was created in UTC.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Time the RBAC Role Binding was deleted in UTC.
     */
    public val deleteTime: Output
        get() = javaResource.deleteTime().applyValue({ args0 -> args0 })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Principal that is be authorized in the cluster (at least of one the oneof is required). Updating one will unset the
     * other automatically. group is the group, as seen by the kubernetes cluster.
     */
    public val group: Output?
        get() = javaResource.group().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Labels for this ScopeRBACRoleBinding. **Note**: This field is non-authoritative, and will only manage the labels present
     * in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The resource name for the RBAC Role Binding
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Role to bind to the principal.
     * Structure is documented below.
     */
    public val role: Output
        get() = javaResource.role().applyValue({ args0 ->
            args0.let({ args0 ->
                scopeRbacRoleBindingRoleToKotlin(args0)
            })
        })

    /**
     * Id of the scope
     */
    public val scopeId: Output
        get() = javaResource.scopeId().applyValue({ args0 -> args0 })

    /**
     * The client-provided identifier of the RBAC Role Binding.
     */
    public val scopeRbacRoleBindingId: Output
        get() = javaResource.scopeRbacRoleBindingId().applyValue({ args0 -> args0 })

    /**
     * State of the RBAC Role Binding resource.
     * Structure is documented below.
     */
    public val states: Output>
        get() = javaResource.states().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    scopeRbacRoleBindingStateToKotlin(args0)
                })
            })
        })

    /**
     * Google-generated UUID for this resource.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * Time the RBAC Role Binding was updated in UTC.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })

    /**
     * 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 val user: Output?
        get() = javaResource.user().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object ScopeRbacRoleBindingMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.gkehub.ScopeRbacRoleBinding::class == javaResource::class

    override fun map(javaResource: Resource): ScopeRbacRoleBinding = ScopeRbacRoleBinding(
        javaResource
            as com.pulumi.gcp.gkehub.ScopeRbacRoleBinding,
    )
}

/**
 * @see [ScopeRbacRoleBinding].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [ScopeRbacRoleBinding].
 */
public suspend fun scopeRbacRoleBinding(
    name: String,
    block: suspend ScopeRbacRoleBindingResourceBuilder.() -> Unit,
): ScopeRbacRoleBinding {
    val builder = ScopeRbacRoleBindingResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [ScopeRbacRoleBinding].
 * @param name The _unique_ name of the resulting resource.
 */
public fun scopeRbacRoleBinding(name: String): ScopeRbacRoleBinding {
    val builder = ScopeRbacRoleBindingResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy