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

com.pulumi.googlenative.dataproc.v1beta2.kotlin.Cluster.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.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.googlenative.dataproc.v1beta2.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.dataproc.v1beta2.kotlin.outputs.ClusterConfigResponse
import com.pulumi.googlenative.dataproc.v1beta2.kotlin.outputs.ClusterMetricsResponse
import com.pulumi.googlenative.dataproc.v1beta2.kotlin.outputs.ClusterStatusResponse
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.googlenative.dataproc.v1beta2.kotlin.outputs.ClusterConfigResponse.Companion.toKotlin as clusterConfigResponseToKotlin
import com.pulumi.googlenative.dataproc.v1beta2.kotlin.outputs.ClusterMetricsResponse.Companion.toKotlin as clusterMetricsResponseToKotlin
import com.pulumi.googlenative.dataproc.v1beta2.kotlin.outputs.ClusterStatusResponse.Companion.toKotlin as clusterStatusResponseToKotlin

/**
 * 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.googlenative.dataproc.v1beta2.Cluster(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return Cluster(builtJavaResource)
    }
}

/**
 * Creates a cluster in a project. The returned Operation.metadata will be ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#clusteroperationmetadata).
 * Auto-naming is currently not supported for this resource.
 */
public class Cluster internal constructor(
    override val javaResource: com.pulumi.googlenative.dataproc.v1beta2.Cluster,
) : KotlinCustomResource(javaResource, ClusterMapper) {
    /**
     * The cluster name. Cluster names within a project must be unique. Names of deleted clusters can be reused.
     */
    public val clusterName: Output
        get() = javaResource.clusterName().applyValue({ args0 -> args0 })

    /**
     * A cluster UUID (Unique Universal Identifier). Dataproc generates this value when it creates the cluster.
     */
    public val clusterUuid: Output
        get() = javaResource.clusterUuid().applyValue({ args0 -> args0 })

    /**
     * The cluster config. Note that Dataproc may set default values, and values may change when clusters are updated.
     */
    public val config: Output
        get() = javaResource.config().applyValue({ args0 ->
            args0.let({ args0 ->
                clusterConfigResponseToKotlin(args0)
            })
        })

    /**
     * Optional. The labels to associate with this cluster. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a cluster.
     */
    public val labels: Output>
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Contains cluster daemon metrics such as HDFS and YARN stats.Beta Feature: This report is available for testing purposes only. It may be changed before final release.
     */
    public val metrics: Output
        get() = javaResource.metrics().applyValue({ args0 ->
            args0.let({ args0 ->
                clusterMetricsResponseToKotlin(args0)
            })
        })

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

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

    /**
     * Optional. A unique id used to identify the request. If the server receives two CreateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#google.cloud.dataproc.v1beta2.CreateClusterRequest)s with the same id, then the second request will be ignored and the first google.longrunning.Operation created and stored in the backend is returned.It is recommended to always set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
     */
    public val requestId: Output?
        get() = javaResource.requestId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Cluster status.
     */
    public val status: Output
        get() = javaResource.status().applyValue({ args0 ->
            args0.let({ args0 ->
                clusterStatusResponseToKotlin(args0)
            })
        })

    /**
     * The previous cluster status.
     */
    public val statusHistory: Output>
        get() = javaResource.statusHistory().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> clusterStatusResponseToKotlin(args0) })
            })
        })
}

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

    override fun map(javaResource: Resource): Cluster = Cluster(
        javaResource as
            com.pulumi.googlenative.dataproc.v1beta2.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 - 2025 Weber Informatics LLC | Privacy Policy