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

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

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

    public var args: SecretScopeArgs = SecretScopeArgs()

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

/**
 * Manages KMIP Secret Scopes in a Vault server. This feature requires
 * Vault Enterprise. See the [Vault documentation](https://www.vaultproject.io/docs/secrets/kmip)
 * for more information.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const _default = new vault.kmip.SecretBackend("default", {
 *     path: "kmip",
 *     description: "Vault KMIP backend",
 * });
 * const dev = new vault.kmip.SecretScope("dev", {
 *     path: _default.path,
 *     scope: "dev",
 *     force: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * default = vault.kmip.SecretBackend("default",
 *     path="kmip",
 *     description="Vault KMIP backend")
 * dev = vault.kmip.SecretScope("dev",
 *     path=default.path,
 *     scope="dev",
 *     force=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Vault.Kmip.SecretBackend("default", new()
 *     {
 *         Path = "kmip",
 *         Description = "Vault KMIP backend",
 *     });
 *     var dev = new Vault.Kmip.SecretScope("dev", new()
 *     {
 *         Path = @default.Path,
 *         Scope = "dev",
 *         Force = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/kmip"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := kmip.NewSecretBackend(ctx, "default", &kmip.SecretBackendArgs{
 * 			Path:        pulumi.String("kmip"),
 * 			Description: pulumi.String("Vault KMIP backend"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = kmip.NewSecretScope(ctx, "dev", &kmip.SecretScopeArgs{
 * 			Path:  _default.Path,
 * 			Scope: pulumi.String("dev"),
 * 			Force: pulumi.Bool(true),
 * 		})
 * 		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.kmip.SecretBackend;
 * import com.pulumi.vault.kmip.SecretBackendArgs;
 * import com.pulumi.vault.kmip.SecretScope;
 * import com.pulumi.vault.kmip.SecretScopeArgs;
 * 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 default_ = new SecretBackend("default", SecretBackendArgs.builder()
 *             .path("kmip")
 *             .description("Vault KMIP backend")
 *             .build());
 *         var dev = new SecretScope("dev", SecretScopeArgs.builder()
 *             .path(default_.path())
 *             .scope("dev")
 *             .force(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: vault:kmip:SecretBackend
 *     properties:
 *       path: kmip
 *       description: Vault KMIP backend
 *   dev:
 *     type: vault:kmip:SecretScope
 *     properties:
 *       path: ${default.path}
 *       scope: dev
 *       force: true
 * ```
 * 
 * ## Import
 * KMIP Secret scope can be imported using the `path`, e.g.
 * ```sh
 * $ pulumi import vault:kmip/secretScope:SecretScope dev kmip
 * ```
 */
public class SecretScope internal constructor(
    override val javaResource: com.pulumi.vault.kmip.SecretScope,
) : KotlinCustomResource(javaResource, SecretScopeMapper) {
    /**
     * Boolean field to force deletion even if there are managed objects in the scope.
     */
    public val force: Output?
        get() = javaResource.force().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * 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) })

    /**
     * The unique path this backend should be mounted at. Must
     * not begin or end with a `/`. Defaults to `kmip`.
     */
    public val path: Output
        get() = javaResource.path().applyValue({ args0 -> args0 })

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

public object SecretScopeMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.kmip.SecretScope::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy