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

com.pulumi.gcp.managedkafka.kotlin.Cluster.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.managedkafka.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.managedkafka.kotlin.outputs.ClusterCapacityConfig
import com.pulumi.gcp.managedkafka.kotlin.outputs.ClusterGcpConfig
import com.pulumi.gcp.managedkafka.kotlin.outputs.ClusterRebalanceConfig
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.Map
import com.pulumi.gcp.managedkafka.kotlin.outputs.ClusterCapacityConfig.Companion.toKotlin as clusterCapacityConfigToKotlin
import com.pulumi.gcp.managedkafka.kotlin.outputs.ClusterGcpConfig.Companion.toKotlin as clusterGcpConfigToKotlin
import com.pulumi.gcp.managedkafka.kotlin.outputs.ClusterRebalanceConfig.Companion.toKotlin as clusterRebalanceConfigToKotlin

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

    public var args: ClusterArgs = ClusterArgs()

    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 ClusterArgsBuilder.() -> Unit) {
        val builder = ClusterArgsBuilder()
        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(): Cluster {
        val builtJavaResource = com.pulumi.gcp.managedkafka.Cluster(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Cluster(builtJavaResource)
    }
}

/**
 * ## Example Usage
 * ### Managedkafka Cluster Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = gcp.organizations.getProject({});
 * const example = new gcp.managedkafka.Cluster("example", {
 *     clusterId: "my-cluster",
 *     location: "us-central1",
 *     capacityConfig: {
 *         vcpuCount: "3",
 *         memoryBytes: "3221225472",
 *     },
 *     gcpConfig: {
 *         accessConfig: {
 *             networkConfigs: [{
 *                 subnet: project.then(project => `projects/${project.number}/regions/us-central1/subnetworks/default`),
 *             }],
 *         },
 *     },
 *     rebalanceConfig: {
 *         mode: "NO_REBALANCE",
 *     },
 *     labels: {
 *         key: "value",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.get_project()
 * example = gcp.managedkafka.Cluster("example",
 *     cluster_id="my-cluster",
 *     location="us-central1",
 *     capacity_config={
 *         "vcpu_count": "3",
 *         "memory_bytes": "3221225472",
 *     },
 *     gcp_config={
 *         "access_config": {
 *             "network_configs": [{
 *                 "subnet": f"projects/{project.number}/regions/us-central1/subnetworks/default",
 *             }],
 *         },
 *     },
 *     rebalance_config={
 *         "mode": "NO_REBALANCE",
 *     },
 *     labels={
 *         "key": "value",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var example = new Gcp.ManagedKafka.Cluster("example", new()
 *     {
 *         ClusterId = "my-cluster",
 *         Location = "us-central1",
 *         CapacityConfig = new Gcp.ManagedKafka.Inputs.ClusterCapacityConfigArgs
 *         {
 *             VcpuCount = "3",
 *             MemoryBytes = "3221225472",
 *         },
 *         GcpConfig = new Gcp.ManagedKafka.Inputs.ClusterGcpConfigArgs
 *         {
 *             AccessConfig = new Gcp.ManagedKafka.Inputs.ClusterGcpConfigAccessConfigArgs
 *             {
 *                 NetworkConfigs = new[]
 *                 {
 *                     new Gcp.ManagedKafka.Inputs.ClusterGcpConfigAccessConfigNetworkConfigArgs
 *                     {
 *                         Subnet = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}/regions/us-central1/subnetworks/default",
 *                     },
 *                 },
 *             },
 *         },
 *         RebalanceConfig = new Gcp.ManagedKafka.Inputs.ClusterRebalanceConfigArgs
 *         {
 *             Mode = "NO_REBALANCE",
 *         },
 *         Labels =
 *         {
 *             { "key", "value" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/managedkafka"
 * 	"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 {
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = managedkafka.NewCluster(ctx, "example", &managedkafka.ClusterArgs{
 * 			ClusterId: pulumi.String("my-cluster"),
 * 			Location:  pulumi.String("us-central1"),
 * 			CapacityConfig: &managedkafka.ClusterCapacityConfigArgs{
 * 				VcpuCount:   pulumi.String("3"),
 * 				MemoryBytes: pulumi.String("3221225472"),
 * 			},
 * 			GcpConfig: &managedkafka.ClusterGcpConfigArgs{
 * 				AccessConfig: &managedkafka.ClusterGcpConfigAccessConfigArgs{
 * 					NetworkConfigs: managedkafka.ClusterGcpConfigAccessConfigNetworkConfigArray{
 * 						&managedkafka.ClusterGcpConfigAccessConfigNetworkConfigArgs{
 * 							Subnet: pulumi.Sprintf("projects/%v/regions/us-central1/subnetworks/default", project.Number),
 * 						},
 * 					},
 * 				},
 * 			},
 * 			RebalanceConfig: &managedkafka.ClusterRebalanceConfigArgs{
 * 				Mode: pulumi.String("NO_REBALANCE"),
 * 			},
 * 			Labels: pulumi.StringMap{
 * 				"key": pulumi.String("value"),
 * 			},
 * 		})
 * 		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.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.managedkafka.Cluster;
 * import com.pulumi.gcp.managedkafka.ClusterArgs;
 * import com.pulumi.gcp.managedkafka.inputs.ClusterCapacityConfigArgs;
 * import com.pulumi.gcp.managedkafka.inputs.ClusterGcpConfigArgs;
 * import com.pulumi.gcp.managedkafka.inputs.ClusterGcpConfigAccessConfigArgs;
 * import com.pulumi.gcp.managedkafka.inputs.ClusterRebalanceConfigArgs;
 * 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) {
 *         final var project = OrganizationsFunctions.getProject();
 *         var example = new Cluster("example", ClusterArgs.builder()
 *             .clusterId("my-cluster")
 *             .location("us-central1")
 *             .capacityConfig(ClusterCapacityConfigArgs.builder()
 *                 .vcpuCount(3)
 *                 .memoryBytes(3221225472)
 *                 .build())
 *             .gcpConfig(ClusterGcpConfigArgs.builder()
 *                 .accessConfig(ClusterGcpConfigAccessConfigArgs.builder()
 *                     .networkConfigs(ClusterGcpConfigAccessConfigNetworkConfigArgs.builder()
 *                         .subnet(String.format("projects/%s/regions/us-central1/subnetworks/default", project.applyValue(getProjectResult -> getProjectResult.number())))
 *                         .build())
 *                     .build())
 *                 .build())
 *             .rebalanceConfig(ClusterRebalanceConfigArgs.builder()
 *                 .mode("NO_REBALANCE")
 *                 .build())
 *             .labels(Map.of("key", "value"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:managedkafka:Cluster
 *     properties:
 *       clusterId: my-cluster
 *       location: us-central1
 *       capacityConfig:
 *         vcpuCount: 3
 *         memoryBytes: 3.221225472e+09
 *       gcpConfig:
 *         accessConfig:
 *           networkConfigs:
 *             - subnet: projects/${project.number}/regions/us-central1/subnetworks/default
 *       rebalanceConfig:
 *         mode: NO_REBALANCE
 *       labels:
 *         key: value
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ### Managedkafka Cluster Cmek
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const keyRing = new gcp.kms.KeyRing("key_ring", {
 *     name: "example-key-ring",
 *     location: "us-central1",
 * });
 * const key = new gcp.kms.CryptoKey("key", {
 *     name: "example-key",
 *     keyRing: keyRing.id,
 * });
 * const project = gcp.organizations.getProject({});
 * const example = new gcp.managedkafka.Cluster("example", {
 *     clusterId: "my-cluster",
 *     location: "us-central1",
 *     capacityConfig: {
 *         vcpuCount: "3",
 *         memoryBytes: "3221225472",
 *     },
 *     gcpConfig: {
 *         accessConfig: {
 *             networkConfigs: [{
 *                 subnet: project.then(project => `projects/${project.number}/regions/us-central1/subnetworks/default`),
 *             }],
 *         },
 *         kmsKey: key.id,
 *     },
 * });
 * const kafkaServiceIdentity = new gcp.projects.ServiceIdentity("kafka_service_identity", {
 *     project: project.then(project => project.projectId),
 *     service: "managedkafka.googleapis.com",
 * });
 * const cryptoKeyBinding = new gcp.kms.CryptoKeyIAMBinding("crypto_key_binding", {
 *     cryptoKeyId: key.id,
 *     role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     members: [project.then(project => `serviceAccount:service-${project.number}@gcp-sa-managedkafka.iam.gserviceaccount.com`)],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * key_ring = gcp.kms.KeyRing("key_ring",
 *     name="example-key-ring",
 *     location="us-central1")
 * key = gcp.kms.CryptoKey("key",
 *     name="example-key",
 *     key_ring=key_ring.id)
 * project = gcp.organizations.get_project()
 * example = gcp.managedkafka.Cluster("example",
 *     cluster_id="my-cluster",
 *     location="us-central1",
 *     capacity_config={
 *         "vcpu_count": "3",
 *         "memory_bytes": "3221225472",
 *     },
 *     gcp_config={
 *         "access_config": {
 *             "network_configs": [{
 *                 "subnet": f"projects/{project.number}/regions/us-central1/subnetworks/default",
 *             }],
 *         },
 *         "kms_key": key.id,
 *     })
 * kafka_service_identity = gcp.projects.ServiceIdentity("kafka_service_identity",
 *     project=project.project_id,
 *     service="managedkafka.googleapis.com")
 * crypto_key_binding = gcp.kms.CryptoKeyIAMBinding("crypto_key_binding",
 *     crypto_key_id=key.id,
 *     role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     members=[f"serviceAccount:service-{project.number}@gcp-sa-managedkafka.iam.gserviceaccount.com"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var keyRing = new Gcp.Kms.KeyRing("key_ring", new()
 *     {
 *         Name = "example-key-ring",
 *         Location = "us-central1",
 *     });
 *     var key = new Gcp.Kms.CryptoKey("key", new()
 *     {
 *         Name = "example-key",
 *         KeyRing = keyRing.Id,
 *     });
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var example = new Gcp.ManagedKafka.Cluster("example", new()
 *     {
 *         ClusterId = "my-cluster",
 *         Location = "us-central1",
 *         CapacityConfig = new Gcp.ManagedKafka.Inputs.ClusterCapacityConfigArgs
 *         {
 *             VcpuCount = "3",
 *             MemoryBytes = "3221225472",
 *         },
 *         GcpConfig = new Gcp.ManagedKafka.Inputs.ClusterGcpConfigArgs
 *         {
 *             AccessConfig = new Gcp.ManagedKafka.Inputs.ClusterGcpConfigAccessConfigArgs
 *             {
 *                 NetworkConfigs = new[]
 *                 {
 *                     new Gcp.ManagedKafka.Inputs.ClusterGcpConfigAccessConfigNetworkConfigArgs
 *                     {
 *                         Subnet = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}/regions/us-central1/subnetworks/default",
 *                     },
 *                 },
 *             },
 *             KmsKey = key.Id,
 *         },
 *     });
 *     var kafkaServiceIdentity = new Gcp.Projects.ServiceIdentity("kafka_service_identity", new()
 *     {
 *         Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
 *         Service = "managedkafka.googleapis.com",
 *     });
 *     var cryptoKeyBinding = new Gcp.Kms.CryptoKeyIAMBinding("crypto_key_binding", new()
 *     {
 *         CryptoKeyId = key.Id,
 *         Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *         Members = new[]
 *         {
 *             $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-managedkafka.iam.gserviceaccount.com",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/managedkafka"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		keyRing, err := kms.NewKeyRing(ctx, "key_ring", &kms.KeyRingArgs{
 * 			Name:     pulumi.String("example-key-ring"),
 * 			Location: pulumi.String("us-central1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		key, err := kms.NewCryptoKey(ctx, "key", &kms.CryptoKeyArgs{
 * 			Name:    pulumi.String("example-key"),
 * 			KeyRing: keyRing.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = managedkafka.NewCluster(ctx, "example", &managedkafka.ClusterArgs{
 * 			ClusterId: pulumi.String("my-cluster"),
 * 			Location:  pulumi.String("us-central1"),
 * 			CapacityConfig: &managedkafka.ClusterCapacityConfigArgs{
 * 				VcpuCount:   pulumi.String("3"),
 * 				MemoryBytes: pulumi.String("3221225472"),
 * 			},
 * 			GcpConfig: &managedkafka.ClusterGcpConfigArgs{
 * 				AccessConfig: &managedkafka.ClusterGcpConfigAccessConfigArgs{
 * 					NetworkConfigs: managedkafka.ClusterGcpConfigAccessConfigNetworkConfigArray{
 * 						&managedkafka.ClusterGcpConfigAccessConfigNetworkConfigArgs{
 * 							Subnet: pulumi.Sprintf("projects/%v/regions/us-central1/subnetworks/default", project.Number),
 * 						},
 * 					},
 * 				},
 * 				KmsKey: key.ID(),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = projects.NewServiceIdentity(ctx, "kafka_service_identity", &projects.ServiceIdentityArgs{
 * 			Project: pulumi.String(project.ProjectId),
 * 			Service: pulumi.String("managedkafka.googleapis.com"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = kms.NewCryptoKeyIAMBinding(ctx, "crypto_key_binding", &kms.CryptoKeyIAMBindingArgs{
 * 			CryptoKeyId: key.ID(),
 * 			Role:        pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
 * 			Members: pulumi.StringArray{
 * 				pulumi.Sprintf("serviceAccount:service-%[email protected]", project.Number),
 * 			},
 * 		})
 * 		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.kms.KeyRing;
 * import com.pulumi.gcp.kms.KeyRingArgs;
 * import com.pulumi.gcp.kms.CryptoKey;
 * import com.pulumi.gcp.kms.CryptoKeyArgs;
 * import com.pulumi.gcp.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.managedkafka.Cluster;
 * import com.pulumi.gcp.managedkafka.ClusterArgs;
 * import com.pulumi.gcp.managedkafka.inputs.ClusterCapacityConfigArgs;
 * import com.pulumi.gcp.managedkafka.inputs.ClusterGcpConfigArgs;
 * import com.pulumi.gcp.managedkafka.inputs.ClusterGcpConfigAccessConfigArgs;
 * import com.pulumi.gcp.projects.ServiceIdentity;
 * import com.pulumi.gcp.projects.ServiceIdentityArgs;
 * import com.pulumi.gcp.kms.CryptoKeyIAMBinding;
 * import com.pulumi.gcp.kms.CryptoKeyIAMBindingArgs;
 * 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 keyRing = new KeyRing("keyRing", KeyRingArgs.builder()
 *             .name("example-key-ring")
 *             .location("us-central1")
 *             .build());
 *         var key = new CryptoKey("key", CryptoKeyArgs.builder()
 *             .name("example-key")
 *             .keyRing(keyRing.id())
 *             .build());
 *         final var project = OrganizationsFunctions.getProject();
 *         var example = new Cluster("example", ClusterArgs.builder()
 *             .clusterId("my-cluster")
 *             .location("us-central1")
 *             .capacityConfig(ClusterCapacityConfigArgs.builder()
 *                 .vcpuCount(3)
 *                 .memoryBytes(3221225472)
 *                 .build())
 *             .gcpConfig(ClusterGcpConfigArgs.builder()
 *                 .accessConfig(ClusterGcpConfigAccessConfigArgs.builder()
 *                     .networkConfigs(ClusterGcpConfigAccessConfigNetworkConfigArgs.builder()
 *                         .subnet(String.format("projects/%s/regions/us-central1/subnetworks/default", project.applyValue(getProjectResult -> getProjectResult.number())))
 *                         .build())
 *                     .build())
 *                 .kmsKey(key.id())
 *                 .build())
 *             .build());
 *         var kafkaServiceIdentity = new ServiceIdentity("kafkaServiceIdentity", ServiceIdentityArgs.builder()
 *             .project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
 *             .service("managedkafka.googleapis.com")
 *             .build());
 *         var cryptoKeyBinding = new CryptoKeyIAMBinding("cryptoKeyBinding", CryptoKeyIAMBindingArgs.builder()
 *             .cryptoKeyId(key.id())
 *             .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
 *             .members(String.format("serviceAccount:service-%[email protected]", project.applyValue(getProjectResult -> getProjectResult.number())))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:managedkafka:Cluster
 *     properties:
 *       clusterId: my-cluster
 *       location: us-central1
 *       capacityConfig:
 *         vcpuCount: 3
 *         memoryBytes: 3.221225472e+09
 *       gcpConfig:
 *         accessConfig:
 *           networkConfigs:
 *             - subnet: projects/${project.number}/regions/us-central1/subnetworks/default
 *         kmsKey: ${key.id}
 *   kafkaServiceIdentity:
 *     type: gcp:projects:ServiceIdentity
 *     name: kafka_service_identity
 *     properties:
 *       project: ${project.projectId}
 *       service: managedkafka.googleapis.com
 *   key:
 *     type: gcp:kms:CryptoKey
 *     properties:
 *       name: example-key
 *       keyRing: ${keyRing.id}
 *   keyRing:
 *     type: gcp:kms:KeyRing
 *     name: key_ring
 *     properties:
 *       name: example-key-ring
 *       location: us-central1
 *   cryptoKeyBinding:
 *     type: gcp:kms:CryptoKeyIAMBinding
 *     name: crypto_key_binding
 *     properties:
 *       cryptoKeyId: ${key.id}
 *       role: roles/cloudkms.cryptoKeyEncrypterDecrypter
 *       members:
 *         - serviceAccount:service-${project.number}@gcp-sa-managedkafka.iam.gserviceaccount.com
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Cluster can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}`
 * * `{{project}}/{{location}}/{{cluster_id}}`
 * * `{{location}}/{{cluster_id}}`
 * When using the `pulumi import` command, Cluster can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:managedkafka/cluster:Cluster default projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:managedkafka/cluster:Cluster default {{project}}/{{location}}/{{cluster_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:managedkafka/cluster:Cluster default {{location}}/{{cluster_id}}
 * ```
 */
public class Cluster internal constructor(
    override val javaResource: com.pulumi.gcp.managedkafka.Cluster,
) : KotlinCustomResource(javaResource, ClusterMapper) {
    /**
     * A capacity configuration of a Kafka cluster.
     * Structure is documented below.
     */
    public val capacityConfig: Output
        get() = javaResource.capacityConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                clusterCapacityConfigToKotlin(args0)
            })
        })

    /**
     * The ID to use for the cluster, which will become the final component of the cluster's name. The ID must be 1-63 characters long, and match the regular expression `a-z?` to comply with RFC 1035. This value is structured like: `my-cluster-id`.
     */
    public val clusterId: Output
        get() = javaResource.clusterId().applyValue({ args0 -> args0 })

    /**
     * The time when the cluster was created.
     */
    public val createTime: Output
        get() = javaResource.createTime().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()
        })

    /**
     * Configuration properties for a Kafka cluster deployed to Google Cloud Platform.
     * Structure is documented below.
     */
    public val gcpConfig: Output
        get() = javaResource.gcpConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                clusterGcpConfigToKotlin(args0)
            })
        })

    /**
     * List of label KEY=VALUE pairs to add. Keys must start with a lowercase character and contain only hyphens (-),
     * underscores ( ), lowercase characters, and numbers. Values must contain only hyphens (-), underscores ( ), lowercase
     * characters, and numbers. **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)
        })

    /**
     * ID of the location of the Kafka resource. See https://cloud.google.com/managed-kafka/docs/locations for a list of supported locations.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name of the cluster. Structured like: `projects/PROJECT_ID/locations/LOCATION/clusters/CLUSTER_ID`.
     */
    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()
        })

    /**
     * Defines rebalancing behavior of a Kafka cluster.
     */
    public val rebalanceConfig: Output?
        get() = javaResource.rebalanceConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> clusterRebalanceConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The current state of the cluster. Possible values: `STATE_UNSPECIFIED`, `CREATING`, `ACTIVE`, `DELETING`.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * The time when the cluster was last updated.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object ClusterMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.managedkafka.Cluster::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy