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

com.pulumi.gcp.composer.kotlin.UserWorkloadsConfigMap.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.composer.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
import kotlin.collections.Map

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

    public var args: UserWorkloadsConfigMapArgs = UserWorkloadsConfigMapArgs()

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

/**
 * ## Example Usage
 * ### Composer User Workloads Config Map Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const environment = new gcp.composer.Environment("environment", {
 *     name: "test-environment",
 *     region: "us-central1",
 *     config: {
 *         softwareConfig: {
 *             imageVersion: "composer-3-airflow-2",
 *         },
 *     },
 * });
 * const configMap = new gcp.composer.UserWorkloadsConfigMap("config_map", {
 *     name: "test-config-map",
 *     region: "us-central1",
 *     environment: environment.name,
 *     data: {
 *         api_host: "apihost:443",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * environment = gcp.composer.Environment("environment",
 *     name="test-environment",
 *     region="us-central1",
 *     config={
 *         "software_config": {
 *             "image_version": "composer-3-airflow-2",
 *         },
 *     })
 * config_map = gcp.composer.UserWorkloadsConfigMap("config_map",
 *     name="test-config-map",
 *     region="us-central1",
 *     environment=environment.name,
 *     data={
 *         "api_host": "apihost:443",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var environment = new Gcp.Composer.Environment("environment", new()
 *     {
 *         Name = "test-environment",
 *         Region = "us-central1",
 *         Config = new Gcp.Composer.Inputs.EnvironmentConfigArgs
 *         {
 *             SoftwareConfig = new Gcp.Composer.Inputs.EnvironmentConfigSoftwareConfigArgs
 *             {
 *                 ImageVersion = "composer-3-airflow-2",
 *             },
 *         },
 *     });
 *     var configMap = new Gcp.Composer.UserWorkloadsConfigMap("config_map", new()
 *     {
 *         Name = "test-config-map",
 *         Region = "us-central1",
 *         Environment = environment.Name,
 *         Data =
 *         {
 *             { "api_host", "apihost:443" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/composer"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		environment, err := composer.NewEnvironment(ctx, "environment", &composer.EnvironmentArgs{
 * 			Name:   pulumi.String("test-environment"),
 * 			Region: pulumi.String("us-central1"),
 * 			Config: &composer.EnvironmentConfigArgs{
 * 				SoftwareConfig: &composer.EnvironmentConfigSoftwareConfigArgs{
 * 					ImageVersion: pulumi.String("composer-3-airflow-2"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = composer.NewUserWorkloadsConfigMap(ctx, "config_map", &composer.UserWorkloadsConfigMapArgs{
 * 			Name:        pulumi.String("test-config-map"),
 * 			Region:      pulumi.String("us-central1"),
 * 			Environment: environment.Name,
 * 			Data: pulumi.StringMap{
 * 				"api_host": pulumi.String("apihost:443"),
 * 			},
 * 		})
 * 		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.composer.Environment;
 * import com.pulumi.gcp.composer.EnvironmentArgs;
 * import com.pulumi.gcp.composer.inputs.EnvironmentConfigArgs;
 * import com.pulumi.gcp.composer.inputs.EnvironmentConfigSoftwareConfigArgs;
 * import com.pulumi.gcp.composer.UserWorkloadsConfigMap;
 * import com.pulumi.gcp.composer.UserWorkloadsConfigMapArgs;
 * 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 environment = new Environment("environment", EnvironmentArgs.builder()
 *             .name("test-environment")
 *             .region("us-central1")
 *             .config(EnvironmentConfigArgs.builder()
 *                 .softwareConfig(EnvironmentConfigSoftwareConfigArgs.builder()
 *                     .imageVersion("composer-3-airflow-2")
 *                     .build())
 *                 .build())
 *             .build());
 *         var configMap = new UserWorkloadsConfigMap("configMap", UserWorkloadsConfigMapArgs.builder()
 *             .name("test-config-map")
 *             .region("us-central1")
 *             .environment(environment.name())
 *             .data(Map.of("api_host", "apihost:443"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   environment:
 *     type: gcp:composer:Environment
 *     properties:
 *       name: test-environment
 *       region: us-central1
 *       config:
 *         softwareConfig:
 *           imageVersion: composer-3-airflow-2
 *   configMap:
 *     type: gcp:composer:UserWorkloadsConfigMap
 *     name: config_map
 *     properties:
 *       name: test-config-map
 *       region: us-central1
 *       environment: ${environment.name}
 *       data:
 *         api_host: apihost:443
 * ```
 * 
 * ## Import
 * UserWorkloadsConfigMap can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsConfigMaps/{{name}}`
 * * `{{project}}/{{region}}/{{environment}}/{{name}}`
 * * `{{region}}/{{environment}}/{{name}}`
 * * `{{environment}}/{{name}}`
 * When using the `pulumi import` command, UserWorkloadsConfigMap can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:composer/userWorkloadsConfigMap:UserWorkloadsConfigMap default projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsConfigMaps/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:composer/userWorkloadsConfigMap:UserWorkloadsConfigMap default {{project}}/{{region}}/{{environment}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:composer/userWorkloadsConfigMap:UserWorkloadsConfigMap default {{region}}/{{environment}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:composer/userWorkloadsConfigMap:UserWorkloadsConfigMap default {{environment}}/{{name}}
 * ```
 */
public class UserWorkloadsConfigMap internal constructor(
    override val javaResource: com.pulumi.gcp.composer.UserWorkloadsConfigMap,
) : KotlinCustomResource(javaResource, UserWorkloadsConfigMapMapper) {
    /**
     * The "data" field of Kubernetes ConfigMap, organized in key-value pairs.
     * For details see: https://kubernetes.io/docs/concepts/configuration/configmap/
     */
    public val `data`: Output>?
        get() = javaResource.`data`().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Environment where the Kubernetes ConfigMap will be stored and used.
     * - - -
     */
    public val environment: Output
        get() = javaResource.environment().applyValue({ args0 -> args0 })

    /**
     * Name of the Kubernetes ConfigMap.
     */
    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 location or Compute Engine region for the environment.
     */
    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy