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

com.pulumi.vault.kotlin.Plugin.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: 6.4.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.vault.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.List

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

    public var args: PluginArgs = PluginArgs()

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

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const jwt = new vault.Plugin("jwt", {
 *     type: "auth",
 *     name: "jwt",
 *     command: "vault-plugin-auth-jwt",
 *     version: "v0.17.0",
 *     sha256: "6bd0a803ed742aa3ce35e4fa23d2c8d550e6c1567bf63410cec489c28b68b0fc",
 *     envs: ["HTTP_PROXY=http://proxy.example.com:8080"],
 * });
 * const jwtAuth = new vault.AuthBackend("jwt_auth", {type: jwt.name});
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * jwt = vault.Plugin("jwt",
 *     type="auth",
 *     name="jwt",
 *     command="vault-plugin-auth-jwt",
 *     version="v0.17.0",
 *     sha256="6bd0a803ed742aa3ce35e4fa23d2c8d550e6c1567bf63410cec489c28b68b0fc",
 *     envs=["HTTP_PROXY=http://proxy.example.com:8080"])
 * jwt_auth = vault.AuthBackend("jwt_auth", type=jwt.name)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var jwt = new Vault.Plugin("jwt", new()
 *     {
 *         Type = "auth",
 *         Name = "jwt",
 *         Command = "vault-plugin-auth-jwt",
 *         Version = "v0.17.0",
 *         Sha256 = "6bd0a803ed742aa3ce35e4fa23d2c8d550e6c1567bf63410cec489c28b68b0fc",
 *         Envs = new[]
 *         {
 *             "HTTP_PROXY=http://proxy.example.com:8080",
 *         },
 *     });
 *     var jwtAuth = new Vault.AuthBackend("jwt_auth", new()
 *     {
 *         Type = jwt.Name,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		jwt, err := vault.NewPlugin(ctx, "jwt", &vault.PluginArgs{
 * 			Type:    pulumi.String("auth"),
 * 			Name:    pulumi.String("jwt"),
 * 			Command: pulumi.String("vault-plugin-auth-jwt"),
 * 			Version: pulumi.String("v0.17.0"),
 * 			Sha256:  pulumi.String("6bd0a803ed742aa3ce35e4fa23d2c8d550e6c1567bf63410cec489c28b68b0fc"),
 * 			Envs: pulumi.StringArray{
 * 				pulumi.String("HTTP_PROXY=http://proxy.example.com:8080"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vault.NewAuthBackend(ctx, "jwt_auth", &vault.AuthBackendArgs{
 * 			Type: jwt.Name,
 * 		})
 * 		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.vault.Plugin;
 * import com.pulumi.vault.PluginArgs;
 * import com.pulumi.vault.AuthBackend;
 * import com.pulumi.vault.AuthBackendArgs;
 * 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 jwt = new Plugin("jwt", PluginArgs.builder()
 *             .type("auth")
 *             .name("jwt")
 *             .command("vault-plugin-auth-jwt")
 *             .version("v0.17.0")
 *             .sha256("6bd0a803ed742aa3ce35e4fa23d2c8d550e6c1567bf63410cec489c28b68b0fc")
 *             .envs("HTTP_PROXY=http://proxy.example.com:8080")
 *             .build());
 *         var jwtAuth = new AuthBackend("jwtAuth", AuthBackendArgs.builder()
 *             .type(jwt.name())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   jwt:
 *     type: vault:Plugin
 *     properties:
 *       type: auth
 *       name: jwt
 *       command: vault-plugin-auth-jwt
 *       version: v0.17.0
 *       sha256: 6bd0a803ed742aa3ce35e4fa23d2c8d550e6c1567bf63410cec489c28b68b0fc
 *       envs:
 *         - HTTP_PROXY=http://proxy.example.com:8080
 *   jwtAuth:
 *     type: vault:AuthBackend
 *     name: jwt_auth
 *     properties:
 *       type: ${jwt.name}
 * ```
 * 
 * ## Import
 * Plugins can be imported using `:type/name/:name` or `:type/version/:version/name/:name` as the ID if the version is non-empty, e.g.
 * ```sh
 * $ pulumi import vault:index/plugin:Plugin jwt auth/name/jwt
 * ```
 * ```sh
 * $ pulumi import vault:index/plugin:Plugin jwt auth/version/v0.17.0/name/jwt
 * ```
 */
public class Plugin internal constructor(
    override val javaResource: com.pulumi.vault.Plugin,
) : KotlinCustomResource(javaResource, PluginMapper) {
    /**
     * List of additional args to pass to the plugin.
     */
    public val args: Output>?
        get() = javaResource.args().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * Command to execute the plugin, relative to the server's configured `plugin_directory`.
     */
    public val command: Output
        get() = javaResource.command().applyValue({ args0 -> args0 })

    /**
     * List of additional environment variables to run the plugin with in KEY=VALUE form.
     */
    public val envs: Output>?
        get() = javaResource.envs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

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

    /**
     * Specifies OCI image to run. If specified, setting
     * `command`, `args`, and `env` will update the container's entrypoint, args, and
     * environment variables (append-only) respectively.
     */
    public val ociImage: Output?
        get() = javaResource.ociImage().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Vault plugin runtime to use if `oci_image` is specified.
     */
    public val runtime: Output?
        get() = javaResource.runtime().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * SHA256 sum of the plugin binary.
     */
    public val sha256: Output
        get() = javaResource.sha256().applyValue({ args0 -> args0 })

    /**
     * Type of plugin; one of "auth", "secret", or "database".
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * Semantic version of the plugin.
     */
    public val version: Output?
        get() = javaResource.version().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object PluginMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.Plugin::class == javaResource::class

    override fun map(javaResource: Resource): Plugin = Plugin(javaResource as com.pulumi.vault.Plugin)
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy