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

com.pulumi.gcp.runtimeconfig.kotlin.Config.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.runtimeconfig.kotlin

import com.pulumi.core.Output
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

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

    public var args: ConfigArgs = ConfigArgs()

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

/**
 * ## Example Usage
 * Example creating a RuntimeConfig resource.
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const my_runtime_config = new gcp.runtimeconfig.Config("my-runtime-config", {
 *     name: "my-service-runtime-config",
 *     description: "Runtime configuration values for my service",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * my_runtime_config = gcp.runtimeconfig.Config("my-runtime-config",
 *     name="my-service-runtime-config",
 *     description="Runtime configuration values for my service")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var my_runtime_config = new Gcp.RuntimeConfig.Config("my-runtime-config", new()
 *     {
 *         Name = "my-service-runtime-config",
 *         Description = "Runtime configuration values for my service",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/runtimeconfig"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := runtimeconfig.NewConfig(ctx, "my-runtime-config", &runtimeconfig.ConfigArgs{
 * 			Name:        pulumi.String("my-service-runtime-config"),
 * 			Description: pulumi.String("Runtime configuration values for my service"),
 * 		})
 * 		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.runtimeconfig.Config;
 * import com.pulumi.gcp.runtimeconfig.ConfigArgs;
 * 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 my_runtime_config = new Config("my-runtime-config", ConfigArgs.builder()
 *             .name("my-service-runtime-config")
 *             .description("Runtime configuration values for my service")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   my-runtime-config:
 *     type: gcp:runtimeconfig:Config
 *     properties:
 *       name: my-service-runtime-config
 *       description: Runtime configuration values for my service
 * ```
 * 
 * ## Import
 * Runtime Configs can be imported using the `name` or full config name, e.g.
 * * `projects/{{project_id}}/configs/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Runtime Configs can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:runtimeconfig/config:Config default projects/{{project_id}}/configs/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:runtimeconfig/config:Config default {{name}}
 * ```
 * When importing using only the name, the provider project must be set.
 */
public class Config internal constructor(
    override val javaResource: com.pulumi.gcp.runtimeconfig.Config,
) : KotlinCustomResource(javaResource, ConfigMapper) {
    /**
     * The description to associate with the runtime
     * config.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the runtime config.
     * - - -
     */
    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 })
}

public object ConfigMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.runtimeconfig.Config::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy