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

com.pulumi.gcp.spanner.kotlin.InstanceConfig.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.13.1.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.spanner.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.spanner.kotlin.outputs.InstanceConfigReplica
import com.pulumi.gcp.spanner.kotlin.outputs.InstanceConfigReplica.Companion.toKotlin
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

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

    public var args: InstanceConfigArgs = InstanceConfigArgs()

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

/**
 * A possible configuration for a Cloud Spanner instance. Configurations
 * define the geographic placement of nodes and their replication.
 * To get more information about InstanceConfig, see:
 * * [API documentation](https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instanceConfigs)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/spanner/)
 * ## Example Usage
 * ## Import
 * InstanceConfig can be imported using any of these accepted formats:
 * * `projects/{{project}}/instanceConfigs/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, InstanceConfig can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:spanner/instanceConfig:InstanceConfig default projects/{{project}}/instanceConfigs/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:spanner/instanceConfig:InstanceConfig default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:spanner/instanceConfig:InstanceConfig default {{name}}
 * ```
 */
public class InstanceConfig internal constructor(
    override val javaResource: com.pulumi.gcp.spanner.InstanceConfig,
) : KotlinCustomResource(javaResource, InstanceConfigMapper) {
    /**
     * Base configuration name, e.g. nam3, based on which this configuration is created. Only set for user managed
     * configurations. baseConfig must refer to a configuration of type GOOGLE_MANAGED in the same project as this
     * configuration.
     */
    public val baseConfig: Output
        get() = javaResource.baseConfig().applyValue({ args0 -> args0 })

    /**
     * Output only. Whether this instance config is a Google or User Managed Configuration.
     */
    public val configType: Output
        get() = javaResource.configType().applyValue({ args0 -> args0 })

    /**
     * The name of this instance configuration as it appears in UIs.
     */
    public val displayName: Output
        get() = javaResource.displayName().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()
        })

    /**
     * An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
     * **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)
        })

    /**
     * A unique identifier for the instance configuration. Values are of the
     * form projects//instanceConfigs/[a-z][-a-z0-9]*
     */
    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()
        })

    /**
     * The geographic placement of nodes in this instance configuration and their replication properties.
     * Structure is documented below.
     */
    public val replicas: Output>
        get() = javaResource.replicas().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            })
        })
}

public object InstanceConfigMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.spanner.InstanceConfig::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy