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

com.pulumi.vault.transform.kotlin.TemplateArgs.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.transform.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.vault.transform.TemplateArgs.builder
import kotlin.Any
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * This resource supports the `/transform/template/{name}` Vault endpoint.
 * It creates or updates a template with the given name. If a template with the name does not exist,
 * it will be created. If the template exists, it will be updated with the new attributes.
 * > Requires _Vault Enterprise with the Advanced Data Protection Transform Module_.
 * See [Transform Secrets Engine](https://www.vaultproject.io/docs/secrets/transform)
 * for more information.
 * ## Example Usage
 * Please note that the `pattern` below holds a regex. The regex shown
 * is identical to the one in our [Setup](https://www.vaultproject.io/docs/secrets/transform#setup)
 * docs, `(\d{4})-(\d{4})-(\d{4})-(\d{4})`. However, due to HCL, the
 * backslashes must be escaped to appear correctly in Vault. For further
 * assistance escaping your own custom regex, see String Literals.
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const transform = new vault.Mount("transform", {
 *     path: "transform",
 *     type: "transform",
 * });
 * const numerics = new vault.transform.Alphabet("numerics", {
 *     path: transform.path,
 *     name: "numerics",
 *     alphabet: "0123456789",
 * });
 * const test = new vault.transform.Template("test", {
 *     path: numerics.path,
 *     name: "ccn",
 *     type: "regex",
 *     pattern: "(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})",
 *     alphabet: "numerics",
 *     encodeFormat: "$1-$2-$3-$4",
 *     decodeFormats: {
 *         "last-four-digits": "$4",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * transform = vault.Mount("transform",
 *     path="transform",
 *     type="transform")
 * numerics = vault.transform.Alphabet("numerics",
 *     path=transform.path,
 *     name="numerics",
 *     alphabet="0123456789")
 * test = vault.transform.Template("test",
 *     path=numerics.path,
 *     name="ccn",
 *     type="regex",
 *     pattern="(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})",
 *     alphabet="numerics",
 *     encode_format="$1-$2-$3-$4",
 *     decode_formats={
 *         "last-four-digits": "$4",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var transform = new Vault.Mount("transform", new()
 *     {
 *         Path = "transform",
 *         Type = "transform",
 *     });
 *     var numerics = new Vault.Transform.Alphabet("numerics", new()
 *     {
 *         Path = transform.Path,
 *         Name = "numerics",
 *         AlphabetSet = "0123456789",
 *     });
 *     var test = new Vault.Transform.Template("test", new()
 *     {
 *         Path = numerics.Path,
 *         Name = "ccn",
 *         Type = "regex",
 *         Pattern = "(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})",
 *         Alphabet = "numerics",
 *         EncodeFormat = "$1-$2-$3-$4",
 *         DecodeFormats =
 *         {
 *             { "last-four-digits", "$4" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/transform"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		transform, err := vault.NewMount(ctx, "transform", &vault.MountArgs{
 * 			Path: pulumi.String("transform"),
 * 			Type: pulumi.String("transform"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		numerics, err := transform.NewAlphabet(ctx, "numerics", &transform.AlphabetArgs{
 * 			Path:     transform.Path,
 * 			Name:     pulumi.String("numerics"),
 * 			Alphabet: pulumi.String("0123456789"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = transform.NewTemplate(ctx, "test", &transform.TemplateArgs{
 * 			Path:         numerics.Path,
 * 			Name:         pulumi.String("ccn"),
 * 			Type:         pulumi.String("regex"),
 * 			Pattern:      pulumi.String("(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})"),
 * 			Alphabet:     pulumi.String("numerics"),
 * 			EncodeFormat: pulumi.String("$1-$2-$3-$4"),
 * 			DecodeFormats: pulumi.Map{
 * 				"last-four-digits": pulumi.Any("$4"),
 * 			},
 * 		})
 * 		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.transform.Alphabet;
 * import com.pulumi.vault.transform.AlphabetArgs;
 * import com.pulumi.vault.transform.Template;
 * import com.pulumi.vault.transform.TemplateArgs;
 * 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 transform = new Mount("transform", MountArgs.builder()
 *             .path("transform")
 *             .type("transform")
 *             .build());
 *         var numerics = new Alphabet("numerics", AlphabetArgs.builder()
 *             .path(transform.path())
 *             .name("numerics")
 *             .alphabet("0123456789")
 *             .build());
 *         var test = new Template("test", TemplateArgs.builder()
 *             .path(numerics.path())
 *             .name("ccn")
 *             .type("regex")
 *             .pattern("(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})")
 *             .alphabet("numerics")
 *             .encodeFormat("$1-$2-$3-$4")
 *             .decodeFormats(Map.of("last-four-digits", "$4"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   transform:
 *     type: vault:Mount
 *     properties:
 *       path: transform
 *       type: transform
 *   numerics:
 *     type: vault:transform:Alphabet
 *     properties:
 *       path: ${transform.path}
 *       name: numerics
 *       alphabet: '0123456789'
 *   test:
 *     type: vault:transform:Template
 *     properties:
 *       path: ${numerics.path}
 *       name: ccn
 *       type: regex
 *       pattern: (\d{4})[- ](\d{4})[- ](\d{4})[- ](\d{4})
 *       alphabet: numerics
 *       encodeFormat: $1-$2-$3-$4
 *       decodeFormats:
 *         last-four-digits: $4
 * ```
 * 
 * @property alphabet The alphabet to use for this template. This is only used during FPE transformations.
 * @property decodeFormats Optional mapping of name to regular expression template, used to customize
 * the decoded output. (requires Vault Enterprise 1.9+)
 * @property encodeFormat The regular expression template used to format encoded values.
 * (requires Vault Enterprise 1.9+)
 * @property name The name of the template.
 * @property namespace 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*.
 * @property path Path to where the back-end is mounted within Vault.
 * @property pattern The pattern used for matching. Currently, only regular expression pattern is supported.
 * @property type The pattern type to use for match detection. Currently, only regex is supported.
 */
public data class TemplateArgs(
    public val alphabet: Output? = null,
    public val decodeFormats: Output>? = null,
    public val encodeFormat: Output? = null,
    public val name: Output? = null,
    public val namespace: Output? = null,
    public val path: Output? = null,
    public val pattern: Output? = null,
    public val type: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.vault.transform.TemplateArgs =
        com.pulumi.vault.transform.TemplateArgs.builder()
            .alphabet(alphabet?.applyValue({ args0 -> args0 }))
            .decodeFormats(
                decodeFormats?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .encodeFormat(encodeFormat?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .namespace(namespace?.applyValue({ args0 -> args0 }))
            .path(path?.applyValue({ args0 -> args0 }))
            .pattern(pattern?.applyValue({ args0 -> args0 }))
            .type(type?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [TemplateArgs].
 */
@PulumiTagMarker
public class TemplateArgsBuilder internal constructor() {
    private var alphabet: Output? = null

    private var decodeFormats: Output>? = null

    private var encodeFormat: Output? = null

    private var name: Output? = null

    private var namespace: Output? = null

    private var path: Output? = null

    private var pattern: Output? = null

    private var type: Output? = null

    /**
     * @param value The alphabet to use for this template. This is only used during FPE transformations.
     */
    @JvmName("viuuhhflmdoatnwq")
    public suspend fun alphabet(`value`: Output) {
        this.alphabet = value
    }

    /**
     * @param value Optional mapping of name to regular expression template, used to customize
     * the decoded output. (requires Vault Enterprise 1.9+)
     */
    @JvmName("dfhqujcusugusjla")
    public suspend fun decodeFormats(`value`: Output>) {
        this.decodeFormats = value
    }

    /**
     * @param value The regular expression template used to format encoded values.
     * (requires Vault Enterprise 1.9+)
     */
    @JvmName("uxikkyikoguvuhaw")
    public suspend fun encodeFormat(`value`: Output) {
        this.encodeFormat = value
    }

    /**
     * @param value The name of the template.
     */
    @JvmName("llcmieopmbhqjvhc")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value 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*.
     */
    @JvmName("udexqjbgtmgywgxu")
    public suspend fun namespace(`value`: Output) {
        this.namespace = value
    }

    /**
     * @param value Path to where the back-end is mounted within Vault.
     */
    @JvmName("jpmpbibvyysqawao")
    public suspend fun path(`value`: Output) {
        this.path = value
    }

    /**
     * @param value The pattern used for matching. Currently, only regular expression pattern is supported.
     */
    @JvmName("artimvwtojlhppvp")
    public suspend fun pattern(`value`: Output) {
        this.pattern = value
    }

    /**
     * @param value The pattern type to use for match detection. Currently, only regex is supported.
     */
    @JvmName("ycimrwuypqhitncj")
    public suspend fun type(`value`: Output) {
        this.type = value
    }

    /**
     * @param value The alphabet to use for this template. This is only used during FPE transformations.
     */
    @JvmName("koqvtoidvulsbpbb")
    public suspend fun alphabet(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.alphabet = mapped
    }

    /**
     * @param value Optional mapping of name to regular expression template, used to customize
     * the decoded output. (requires Vault Enterprise 1.9+)
     */
    @JvmName("pguwghamwahpmasa")
    public suspend fun decodeFormats(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.decodeFormats = mapped
    }

    /**
     * @param values Optional mapping of name to regular expression template, used to customize
     * the decoded output. (requires Vault Enterprise 1.9+)
     */
    @JvmName("fvyncghpubtqnyph")
    public fun decodeFormats(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.decodeFormats = mapped
    }

    /**
     * @param value The regular expression template used to format encoded values.
     * (requires Vault Enterprise 1.9+)
     */
    @JvmName("kdwttnkodkykthpn")
    public suspend fun encodeFormat(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.encodeFormat = mapped
    }

    /**
     * @param value The name of the template.
     */
    @JvmName("lhswehtgedtckxxf")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value 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*.
     */
    @JvmName("gwxbigsungcjtcfg")
    public suspend fun namespace(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.namespace = mapped
    }

    /**
     * @param value Path to where the back-end is mounted within Vault.
     */
    @JvmName("tvtfvakuwjsogboi")
    public suspend fun path(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.path = mapped
    }

    /**
     * @param value The pattern used for matching. Currently, only regular expression pattern is supported.
     */
    @JvmName("dnbhkjkxihiqnejr")
    public suspend fun pattern(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.pattern = mapped
    }

    /**
     * @param value The pattern type to use for match detection. Currently, only regex is supported.
     */
    @JvmName("uswksaogwehdkgij")
    public suspend fun type(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.type = mapped
    }

    internal fun build(): TemplateArgs = TemplateArgs(
        alphabet = alphabet,
        decodeFormats = decodeFormats,
        encodeFormat = encodeFormat,
        name = name,
        namespace = namespace,
        path = path,
        pattern = pattern,
        type = type,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy