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

com.pulumi.gcp.composer.kotlin.Environment.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.composer.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.composer.kotlin.outputs.EnvironmentConfig
import com.pulumi.gcp.composer.kotlin.outputs.EnvironmentStorageConfig
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.composer.kotlin.outputs.EnvironmentConfig.Companion.toKotlin as environmentConfigToKotlin
import com.pulumi.gcp.composer.kotlin.outputs.EnvironmentStorageConfig.Companion.toKotlin as environmentStorageConfigToKotlin

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

    public var args: EnvironmentArgs = EnvironmentArgs()

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

/**
 *
 * ## Import
 * Environment can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{region}}/environments/{{name}}`
 * * `{{project}}/{{region}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Environment can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:composer/environment:Environment default projects/{{project}}/locations/{{region}}/environments/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:composer/environment:Environment default {{project}}/{{region}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:composer/environment:Environment default {{name}}
 * ```
 */
public class Environment internal constructor(
    override val javaResource: com.pulumi.gcp.composer.Environment,
) : KotlinCustomResource(javaResource, EnvironmentMapper) {
    /**
     * Configuration parameters for this environment.
     */
    public val config: Output
        get() = javaResource.config().applyValue({ args0 ->
            args0.let({ args0 ->
                environmentConfigToKotlin(args0)
            })
        })

    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * User-defined labels for this environment. The labels map can contain no more than 64 entries. Entries of the labels map
     * are UTF8 strings that comply with the following restrictions: Label keys must be between 1 and 63 characters long and
     * must conform to the following regular expression: a-z?. Label values must be between 0 and 63 characters long and must
     * conform to the regular expression (a-z?)?. No more than 64 labels can be associated with a given environment. Both keys
     * and values must be <= 128 bytes in size. **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)
        })

    /**
     * Name of the environment.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
     */
    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()
        })

    /**
     * The location or Compute Engine region for the environment.
     */
    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })

    /**
     * Configuration options for storage used by Composer environment.
     */
    public val storageConfig: Output
        get() = javaResource.storageConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                environmentStorageConfigToKotlin(args0)
            })
        })
}

public object EnvironmentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.composer.Environment::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy