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

com.pulumi.gcp.composer.kotlin.UserWorkloadsSecret.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.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.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map

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

    public var args: UserWorkloadsSecretArgs = UserWorkloadsSecretArgs()

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

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 * const example = new gcp.composer.Environment("example", {
 *     name: "example-environment",
 *     project: "example-project",
 *     region: "us-central1",
 *     config: {
 *         softwareConfig: {
 *             imageVersion: "example-image-version",
 *         },
 *     },
 * });
 * const exampleUserWorkloadsSecret = new gcp.composer.UserWorkloadsSecret("example", {
 *     name: "example-secret",
 *     project: "example-project",
 *     region: "us-central1",
 *     environment: example.name,
 *     data: {
 *         email: std.base64encode({
 *             input: "example-email",
 *         }).then(invoke => invoke.result),
 *         password: std.base64encode({
 *             input: "example-password",
 *         }).then(invoke => invoke.result),
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_std as std
 * example = gcp.composer.Environment("example",
 *     name="example-environment",
 *     project="example-project",
 *     region="us-central1",
 *     config=gcp.composer.EnvironmentConfigArgs(
 *         software_config=gcp.composer.EnvironmentConfigSoftwareConfigArgs(
 *             image_version="example-image-version",
 *         ),
 *     ))
 * example_user_workloads_secret = gcp.composer.UserWorkloadsSecret("example",
 *     name="example-secret",
 *     project="example-project",
 *     region="us-central1",
 *     environment=example.name,
 *     data={
 *         "email": std.base64encode(input="example-email").result,
 *         "password": std.base64encode(input="example-password").result,
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Gcp.Composer.Environment("example", new()
 *     {
 *         Name = "example-environment",
 *         Project = "example-project",
 *         Region = "us-central1",
 *         Config = new Gcp.Composer.Inputs.EnvironmentConfigArgs
 *         {
 *             SoftwareConfig = new Gcp.Composer.Inputs.EnvironmentConfigSoftwareConfigArgs
 *             {
 *                 ImageVersion = "example-image-version",
 *             },
 *         },
 *     });
 *     var exampleUserWorkloadsSecret = new Gcp.Composer.UserWorkloadsSecret("example", new()
 *     {
 *         Name = "example-secret",
 *         Project = "example-project",
 *         Region = "us-central1",
 *         Environment = example.Name,
 *         Data =
 *         {
 *             { "email", Std.Base64encode.Invoke(new()
 *             {
 *                 Input = "example-email",
 *             }).Apply(invoke => invoke.Result) },
 *             { "password", Std.Base64encode.Invoke(new()
 *             {
 *                 Input = "example-password",
 *             }).Apply(invoke => invoke.Result) },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/composer"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := composer.NewEnvironment(ctx, "example", &composer.EnvironmentArgs{
 * 			Name:    pulumi.String("example-environment"),
 * 			Project: pulumi.String("example-project"),
 * 			Region:  pulumi.String("us-central1"),
 * 			Config: &composer.EnvironmentConfigArgs{
 * 				SoftwareConfig: &composer.EnvironmentConfigSoftwareConfigArgs{
 * 					ImageVersion: pulumi.String("example-image-version"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
 * 			Input: "example-email",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeBase64encode1, err := std.Base64encode(ctx, &std.Base64encodeArgs{
 * 			Input: "example-password",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = composer.NewUserWorkloadsSecret(ctx, "example", &composer.UserWorkloadsSecretArgs{
 * 			Name:        pulumi.String("example-secret"),
 * 			Project:     pulumi.String("example-project"),
 * 			Region:      pulumi.String("us-central1"),
 * 			Environment: example.Name,
 * 			Data: pulumi.Map{
 * 				"email":    invokeBase64encode.Result,
 * 				"password": invokeBase64encode1.Result,
 * 			},
 * 		})
 * 		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.UserWorkloadsSecret;
 * import com.pulumi.gcp.composer.UserWorkloadsSecretArgs;
 * 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 example = new Environment("example", EnvironmentArgs.builder()
 *             .name("example-environment")
 *             .project("example-project")
 *             .region("us-central1")
 *             .config(EnvironmentConfigArgs.builder()
 *                 .softwareConfig(EnvironmentConfigSoftwareConfigArgs.builder()
 *                     .imageVersion("example-image-version")
 *                     .build())
 *                 .build())
 *             .build());
 *         var exampleUserWorkloadsSecret = new UserWorkloadsSecret("exampleUserWorkloadsSecret", UserWorkloadsSecretArgs.builder()
 *             .name("example-secret")
 *             .project("example-project")
 *             .region("us-central1")
 *             .environment(example.name())
 *             .data(Map.ofEntries(
 *                 Map.entry("email", StdFunctions.base64encode(Base64encodeArgs.builder()
 *                     .input("example-email")
 *                     .build()).result()),
 *                 Map.entry("password", StdFunctions.base64encode(Base64encodeArgs.builder()
 *                     .input("example-password")
 *                     .build()).result())
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:composer:Environment
 *     properties:
 *       name: example-environment
 *       project: example-project
 *       region: us-central1
 *       config:
 *         softwareConfig:
 *           imageVersion: example-image-version
 *   exampleUserWorkloadsSecret:
 *     type: gcp:composer:UserWorkloadsSecret
 *     name: example
 *     properties:
 *       name: example-secret
 *       project: example-project
 *       region: us-central1
 *       environment: ${example.name}
 *       data:
 *         email:
 *           fn::invoke:
 *             Function: std:base64encode
 *             Arguments:
 *               input: example-email
 *             Return: result
 *         password:
 *           fn::invoke:
 *             Function: std:base64encode
 *             Arguments:
 *               input: example-password
 *             Return: result
 * ```
 * 
 * ## Import
 * Secret can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsSecrets/{{name}}`
 * * `{{project}}/{{region}}/{{environment}}/{{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/userWorkloadsSecret:UserWorkloadsSecret example projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsSecrets/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:composer/userWorkloadsSecret:UserWorkloadsSecret example {{project}}/{{region}}/{{environment}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:composer/userWorkloadsSecret:UserWorkloadsSecret example {{name}}
 * ```
 */
public class UserWorkloadsSecret internal constructor(
    override val javaResource: com.pulumi.gcp.composer.UserWorkloadsSecret,
) : KotlinCustomResource(javaResource, UserWorkloadsSecretMapper) {
    /**
     * A map of the secret data.
     */
    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 Secret will be stored and used.
     */
    public val environment: Output
        get() = javaResource.environment().applyValue({ args0 -> args0 })

    /**
     * Name of the Kubernetes Secret.
     */
    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 UserWorkloadsSecretMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.composer.UserWorkloadsSecret::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy