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

com.pulumi.vault.mongodbatlas.kotlin.SecretBackend.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.mongodbatlas.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 [SecretBackend].
 */
@PulumiTagMarker
public class SecretBackendResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: SecretBackendArgs = SecretBackendArgs()

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

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const mongo = new vault.Mount("mongo", {
 *     path: "mongodbatlas",
 *     type: "mongodbatlas",
 *     description: "MongoDB Atlas secret engine mount",
 * });
 * const config = new vault.mongodbatlas.SecretBackend("config", {
 *     mount: mongo.path,
 *     privateKey: "privateKey",
 *     publicKey: "publicKey",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * mongo = vault.Mount("mongo",
 *     path="mongodbatlas",
 *     type="mongodbatlas",
 *     description="MongoDB Atlas secret engine mount")
 * config = vault.mongodbatlas.SecretBackend("config",
 *     mount=mongo.path,
 *     private_key="privateKey",
 *     public_key="publicKey")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var mongo = new Vault.Mount("mongo", new()
 *     {
 *         Path = "mongodbatlas",
 *         Type = "mongodbatlas",
 *         Description = "MongoDB Atlas secret engine mount",
 *     });
 *     var config = new Vault.MongoDBAtlas.SecretBackend("config", new()
 *     {
 *         Mount = mongo.Path,
 *         PrivateKey = "privateKey",
 *         PublicKey = "publicKey",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/mongodbatlas"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		mongo, err := vault.NewMount(ctx, "mongo", &vault.MountArgs{
 * 			Path:        pulumi.String("mongodbatlas"),
 * 			Type:        pulumi.String("mongodbatlas"),
 * 			Description: pulumi.String("MongoDB Atlas secret engine mount"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = mongodbatlas.NewSecretBackend(ctx, "config", &mongodbatlas.SecretBackendArgs{
 * 			Mount:      mongo.Path,
 * 			PrivateKey: pulumi.String("privateKey"),
 * 			PublicKey:  pulumi.String("publicKey"),
 * 		})
 * 		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.Mount;
 * import com.pulumi.vault.MountArgs;
 * import com.pulumi.vault.mongodbatlas.SecretBackend;
 * import com.pulumi.vault.mongodbatlas.SecretBackendArgs;
 * 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 mongo = new Mount("mongo", MountArgs.builder()
 *             .path("mongodbatlas")
 *             .type("mongodbatlas")
 *             .description("MongoDB Atlas secret engine mount")
 *             .build());
 *         var config = new SecretBackend("config", SecretBackendArgs.builder()
 *             .mount(mongo.path())
 *             .privateKey("privateKey")
 *             .publicKey("publicKey")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   mongo:
 *     type: vault:Mount
 *     properties:
 *       path: mongodbatlas
 *       type: mongodbatlas
 *       description: MongoDB Atlas secret engine mount
 *   config:
 *     type: vault:mongodbatlas:SecretBackend
 *     properties:
 *       mount: ${mongo.path}
 *       privateKey: privateKey
 *       publicKey: publicKey
 * ```
 * 
 * ## Import
 * MongoDB Atlas secret backends can be imported using the `${mount}/config`, e.g.
 * ```sh
 * $ pulumi import vault:mongodbatlas/secretBackend:SecretBackend config mongodbatlas/config
 * ```
 */
public class SecretBackend internal constructor(
    override val javaResource: com.pulumi.vault.mongodbatlas.SecretBackend,
) : KotlinCustomResource(javaResource, SecretBackendMapper) {
    /**
     * Path where the MongoDB Atlas Secrets Engine is mounted.
     */
    public val mount: Output
        get() = javaResource.mount().applyValue({ args0 -> args0 })

    /**
     * The namespace to provision the resource in.
     * The value should not contain leading or trailing forward slashes.
     * The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
     * *Available only for Vault Enterprise*.
     */
    public val namespace: Output?
        get() = javaResource.namespace().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Path where MongoDB Atlas configuration is located
     */
    public val path: Output
        get() = javaResource.path().applyValue({ args0 -> args0 })

    /**
     * Specifies the Private API Key used to authenticate with the MongoDB Atlas API.
     */
    public val privateKey: Output
        get() = javaResource.privateKey().applyValue({ args0 -> args0 })

    /**
     * Specifies the Public API Key used to authenticate with the MongoDB Atlas API.
     */
    public val publicKey: Output
        get() = javaResource.publicKey().applyValue({ args0 -> args0 })
}

public object SecretBackendMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.mongodbatlas.SecretBackend::class == javaResource::class

    override fun map(javaResource: Resource): SecretBackend = SecretBackend(
        javaResource as
            com.pulumi.vault.mongodbatlas.SecretBackend,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy