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

com.pulumi.gcp.gkehub.kotlin.MembershipBindingArgs.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.MembershipBindingArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * MembershipBinding is a subresource of a Membership, representing what Fleet Scopes (or other, future Fleet resources) a Membership is bound to.
 * To get more information about MembershipBinding, see:
 * * [API documentation](https://cloud.google.com/anthos/fleet-management/docs/reference/rest/v1/projects.locations.memberships.bindings)
 * * How-to Guides
 *     * [Registering a Cluster](https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster#register_cluster)
 * ## Example Usage
 * ### Gkehub Membership 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_88722",
 *     endpoint: {
 *         gkeCluster: {
 *             resourceLink: pulumi.interpolate`//container.googleapis.com/${primary.id}`,
 *         },
 *     },
 * });
 * const scope = new gcp.gkehub.Scope("scope", {scopeId: "tf-test-scope_39249"});
 * const membershipBinding = new gcp.gkehub.MembershipBinding("membership_binding", {
 *     membershipBindingId: "tf-test-membership-binding_74391",
 *     scope: scope.name,
 *     membershipId: membership.membershipId,
 *     location: "global",
 *     labels: {
 *         keyb: "valueb",
 *         keya: "valuea",
 *         keyc: "valuec",
 *     },
 * });
 * ```
 * ```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_88722",
 *     endpoint=gcp.gkehub.MembershipEndpointArgs(
 *         gke_cluster=gcp.gkehub.MembershipEndpointGkeClusterArgs(
 *             resource_link=primary.id.apply(lambda id: f"//container.googleapis.com/{id}"),
 *         ),
 *     ))
 * scope = gcp.gkehub.Scope("scope", scope_id="tf-test-scope_39249")
 * membership_binding = gcp.gkehub.MembershipBinding("membership_binding",
 *     membership_binding_id="tf-test-membership-binding_74391",
 *     scope=scope.name,
 *     membership_id=membership.membership_id,
 *     location="global",
 *     labels={
 *         "keyb": "valueb",
 *         "keya": "valuea",
 *         "keyc": "valuec",
 *     })
 * ```
 * ```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_88722",
 *         Endpoint = new Gcp.GkeHub.Inputs.MembershipEndpointArgs
 *         {
 *             GkeCluster = new Gcp.GkeHub.Inputs.MembershipEndpointGkeClusterArgs
 *             {
 *                 ResourceLink = primary.Id.Apply(id => $"//container.googleapis.com/{id}"),
 *             },
 *         },
 *     });
 *     var scope = new Gcp.GkeHub.Scope("scope", new()
 *     {
 *         ScopeId = "tf-test-scope_39249",
 *     });
 *     var membershipBinding = new Gcp.GkeHub.MembershipBinding("membership_binding", new()
 *     {
 *         MembershipBindingId = "tf-test-membership-binding_74391",
 *         Scope = scope.Name,
 *         MembershipId = membership.MembershipId,
 *         Location = "global",
 *         Labels =
 *         {
 *             { "keyb", "valueb" },
 *             { "keya", "valuea" },
 *             { "keyc", "valuec" },
 *         },
 *     });
 * });
 * ```
 * ```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/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_88722"),
 * 			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
 * 		}
 * 		scope, err := gkehub.NewScope(ctx, "scope", &gkehub.ScopeArgs{
 * 			ScopeId: pulumi.String("tf-test-scope_39249"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = gkehub.NewMembershipBinding(ctx, "membership_binding", &gkehub.MembershipBindingArgs{
 * 			MembershipBindingId: pulumi.String("tf-test-membership-binding_74391"),
 * 			Scope:               scope.Name,
 * 			MembershipId:        membership.MembershipId,
 * 			Location:            pulumi.String("global"),
 * 			Labels: pulumi.StringMap{
 * 				"keyb": pulumi.String("valueb"),
 * 				"keya": pulumi.String("valuea"),
 * 				"keyc": pulumi.String("valuec"),
 * 			},
 * 		})
 * 		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.gkehub.Scope;
 * import com.pulumi.gcp.gkehub.ScopeArgs;
 * import com.pulumi.gcp.gkehub.MembershipBinding;
 * import com.pulumi.gcp.gkehub.MembershipBindingArgs;
 * 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_88722")
 *             .endpoint(MembershipEndpointArgs.builder()
 *                 .gkeCluster(MembershipEndpointGkeClusterArgs.builder()
 *                     .resourceLink(primary.id().applyValue(id -> String.format("//container.googleapis.com/%s", id)))
 *                     .build())
 *                 .build())
 *             .build());
 *         var scope = new Scope("scope", ScopeArgs.builder()
 *             .scopeId("tf-test-scope_39249")
 *             .build());
 *         var membershipBinding = new MembershipBinding("membershipBinding", MembershipBindingArgs.builder()
 *             .membershipBindingId("tf-test-membership-binding_74391")
 *             .scope(scope.name())
 *             .membershipId(membership.membershipId())
 *             .location("global")
 *             .labels(Map.ofEntries(
 *                 Map.entry("keyb", "valueb"),
 *                 Map.entry("keya", "valuea"),
 *                 Map.entry("keyc", "valuec")
 *             ))
 *             .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_88722
 *       endpoint:
 *         gkeCluster:
 *           resourceLink: //container.googleapis.com/${primary.id}
 *   scope:
 *     type: gcp:gkehub:Scope
 *     properties:
 *       scopeId: tf-test-scope_39249
 *   membershipBinding:
 *     type: gcp:gkehub:MembershipBinding
 *     name: membership_binding
 *     properties:
 *       membershipBindingId: tf-test-membership-binding_74391
 *       scope: ${scope.name}
 *       membershipId: ${membership.membershipId}
 *       location: global
 *       labels:
 *         keyb: valueb
 *         keya: valuea
 *         keyc: valuec
 * ```
 * 
 * ## Import
 * MembershipBinding can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/bindings/{{membership_binding_id}}`
 * * `{{project}}/{{location}}/{{membership_id}}/{{membership_binding_id}}`
 * * `{{location}}/{{membership_id}}/{{membership_binding_id}}`
 * When using the `pulumi import` command, MembershipBinding can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:gkehub/membershipBinding:MembershipBinding default projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/bindings/{{membership_binding_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:gkehub/membershipBinding:MembershipBinding default {{project}}/{{location}}/{{membership_id}}/{{membership_binding_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:gkehub/membershipBinding:MembershipBinding default {{location}}/{{membership_id}}/{{membership_binding_id}}
 * ```
 * @property labels Labels for this Membership binding.
 * **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.
 * @property location Location of the membership
 * - - -
 * @property membershipBindingId The client-provided identifier of the membership binding.
 * @property membershipId Id of the membership
 * @property project The ID of the project in which the resource belongs.
 * If it is not provided, the provider project is used.
 * @property scope A Workspace resource name in the format
 * `projects/*/locations/*/scopes/*`.
 * */*/*/
 */
public data class MembershipBindingArgs(
    public val labels: Output>? = null,
    public val location: Output? = null,
    public val membershipBindingId: Output? = null,
    public val membershipId: Output? = null,
    public val project: Output? = null,
    public val scope: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.gkehub.MembershipBindingArgs =
        com.pulumi.gcp.gkehub.MembershipBindingArgs.builder()
            .labels(labels?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .location(location?.applyValue({ args0 -> args0 }))
            .membershipBindingId(membershipBindingId?.applyValue({ args0 -> args0 }))
            .membershipId(membershipId?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .scope(scope?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [MembershipBindingArgs].
 */
@PulumiTagMarker
public class MembershipBindingArgsBuilder internal constructor() {
    private var labels: Output>? = null

    private var location: Output? = null

    private var membershipBindingId: Output? = null

    private var membershipId: Output? = null

    private var project: Output? = null

    private var scope: Output? = null

    /**
     * @param value Labels for this Membership binding.
     * **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.
     */
    @JvmName("hqlkduodtygvhyme")
    public suspend fun labels(`value`: Output>) {
        this.labels = value
    }

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

    /**
     * @param value The client-provided identifier of the membership binding.
     */
    @JvmName("dkxboonspfeixugq")
    public suspend fun membershipBindingId(`value`: Output) {
        this.membershipBindingId = value
    }

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

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("utjyuabjcrrwejbi")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value A Workspace resource name in the format
     * `projects/*/locations/*/scopes/*`.
     * */*/*/
     */
    @JvmName("orjxjowvwkoretos")
    public suspend fun scope(`value`: Output) {
        this.scope = value
    }

    /**
     * @param value Labels for this Membership binding.
     * **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.
     */
    @JvmName("qiilnkaoecebwmya")
    public suspend fun labels(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param values Labels for this Membership binding.
     * **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.
     */
    @JvmName("kgaydrrvkpnqwkbp")
    public fun labels(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.labels = mapped
    }

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

    /**
     * @param value The client-provided identifier of the membership binding.
     */
    @JvmName("tqqhtrbqneoapjtp")
    public suspend fun membershipBindingId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.membershipBindingId = mapped
    }

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

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("nesthphqsetcogjn")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value A Workspace resource name in the format
     * `projects/*/locations/*/scopes/*`.
     * */*/*/
     */
    @JvmName("lcbxelcflayucclw")
    public suspend fun scope(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scope = mapped
    }

    internal fun build(): MembershipBindingArgs = MembershipBindingArgs(
        labels = labels,
        location = location,
        membershipBindingId = membershipBindingId,
        membershipId = membershipId,
        project = project,
        scope = scope,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy