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

com.pulumi.vault.kotlin.TokenArgs.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.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.TokenArgs.builder
import kotlin.Boolean
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const example = new vault.Token("example", {
 *     roleName: "app",
 *     policies: [
 *         "policy1",
 *         "policy2",
 *     ],
 *     renewable: true,
 *     ttl: "24h",
 *     renewMinLease: 43200,
 *     renewIncrement: 86400,
 *     metadata: {
 *         purpose: "service-account",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * example = vault.Token("example",
 *     role_name="app",
 *     policies=[
 *         "policy1",
 *         "policy2",
 *     ],
 *     renewable=True,
 *     ttl="24h",
 *     renew_min_lease=43200,
 *     renew_increment=86400,
 *     metadata={
 *         "purpose": "service-account",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Vault.Token("example", new()
 *     {
 *         RoleName = "app",
 *         Policies = new[]
 *         {
 *             "policy1",
 *             "policy2",
 *         },
 *         Renewable = true,
 *         Ttl = "24h",
 *         RenewMinLease = 43200,
 *         RenewIncrement = 86400,
 *         Metadata =
 *         {
 *             { "purpose", "service-account" },
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		_, err := vault.NewToken(ctx, "example", &vault.TokenArgs{
 * 			RoleName: pulumi.String("app"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("policy1"),
 * 				pulumi.String("policy2"),
 * 			},
 * 			Renewable:      pulumi.Bool(true),
 * 			Ttl:            pulumi.String("24h"),
 * 			RenewMinLease:  pulumi.Int(43200),
 * 			RenewIncrement: pulumi.Int(86400),
 * 			Metadata: pulumi.StringMap{
 * 				"purpose": pulumi.String("service-account"),
 * 			},
 * 		})
 * 		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.Token;
 * import com.pulumi.vault.TokenArgs;
 * 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 Token("example", TokenArgs.builder()
 *             .roleName("app")
 *             .policies(
 *                 "policy1",
 *                 "policy2")
 *             .renewable(true)
 *             .ttl("24h")
 *             .renewMinLease(43200)
 *             .renewIncrement(86400)
 *             .metadata(Map.of("purpose", "service-account"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: vault:Token
 *     properties:
 *       roleName: app
 *       policies:
 *         - policy1
 *         - policy2
 *       renewable: true
 *       ttl: 24h
 *       renewMinLease: 43200
 *       renewIncrement: 86400
 *       metadata:
 *         purpose: service-account
 * ```
 * 
 * ## Import
 * Tokens can be imported using its `id` as accessor id, e.g.
 * ```sh
 * $ pulumi import vault:index/token:Token example 
 * ```
 * @property displayName String containing the token display name
 * @property explicitMaxTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
 * @property metadata Metadata to be set on this token
 * @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 noDefaultPolicy Flag to not attach the default policy to this token
 * @property noParent Flag to create a token without parent
 * @property numUses The number of allowed uses of this token
 * @property period The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
 * @property policies List of policies to attach to this token
 * @property renewIncrement The renew increment. This is specified in seconds
 * @property renewMinLease The minimal lease to renew this token
 * @property renewable Flag to allow to renew this token
 * @property roleName The token role name
 * @property ttl The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
 * @property wrappingTtl The TTL period of the wrapped token.
 */
public data class TokenArgs(
    public val displayName: Output? = null,
    public val explicitMaxTtl: Output? = null,
    public val metadata: Output>? = null,
    public val namespace: Output? = null,
    public val noDefaultPolicy: Output? = null,
    public val noParent: Output? = null,
    public val numUses: Output? = null,
    public val period: Output? = null,
    public val policies: Output>? = null,
    public val renewIncrement: Output? = null,
    public val renewMinLease: Output? = null,
    public val renewable: Output? = null,
    public val roleName: Output? = null,
    public val ttl: Output? = null,
    public val wrappingTtl: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.vault.TokenArgs = com.pulumi.vault.TokenArgs.builder()
        .displayName(displayName?.applyValue({ args0 -> args0 }))
        .explicitMaxTtl(explicitMaxTtl?.applyValue({ args0 -> args0 }))
        .metadata(
            metadata?.applyValue({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }),
        )
        .namespace(namespace?.applyValue({ args0 -> args0 }))
        .noDefaultPolicy(noDefaultPolicy?.applyValue({ args0 -> args0 }))
        .noParent(noParent?.applyValue({ args0 -> args0 }))
        .numUses(numUses?.applyValue({ args0 -> args0 }))
        .period(period?.applyValue({ args0 -> args0 }))
        .policies(policies?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
        .renewIncrement(renewIncrement?.applyValue({ args0 -> args0 }))
        .renewMinLease(renewMinLease?.applyValue({ args0 -> args0 }))
        .renewable(renewable?.applyValue({ args0 -> args0 }))
        .roleName(roleName?.applyValue({ args0 -> args0 }))
        .ttl(ttl?.applyValue({ args0 -> args0 }))
        .wrappingTtl(wrappingTtl?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [TokenArgs].
 */
@PulumiTagMarker
public class TokenArgsBuilder internal constructor() {
    private var displayName: Output? = null

    private var explicitMaxTtl: Output? = null

    private var metadata: Output>? = null

    private var namespace: Output? = null

    private var noDefaultPolicy: Output? = null

    private var noParent: Output? = null

    private var numUses: Output? = null

    private var period: Output? = null

    private var policies: Output>? = null

    private var renewIncrement: Output? = null

    private var renewMinLease: Output? = null

    private var renewable: Output? = null

    private var roleName: Output? = null

    private var ttl: Output? = null

    private var wrappingTtl: Output? = null

    /**
     * @param value String containing the token display name
     */
    @JvmName("xhvsjydkfiyylgom")
    public suspend fun displayName(`value`: Output) {
        this.displayName = value
    }

    /**
     * @param value The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
     */
    @JvmName("axjocqyqklqiyeto")
    public suspend fun explicitMaxTtl(`value`: Output) {
        this.explicitMaxTtl = value
    }

    /**
     * @param value Metadata to be set on this token
     */
    @JvmName("axqxdldpytyinort")
    public suspend fun metadata(`value`: Output>) {
        this.metadata = 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("lourqesappwjndwt")
    public suspend fun namespace(`value`: Output) {
        this.namespace = value
    }

    /**
     * @param value Flag to not attach the default policy to this token
     */
    @JvmName("fdhvfipdmthvyqqw")
    public suspend fun noDefaultPolicy(`value`: Output) {
        this.noDefaultPolicy = value
    }

    /**
     * @param value Flag to create a token without parent
     */
    @JvmName("atynsmrdbwreryup")
    public suspend fun noParent(`value`: Output) {
        this.noParent = value
    }

    /**
     * @param value The number of allowed uses of this token
     */
    @JvmName("eopxvfopvgplkhce")
    public suspend fun numUses(`value`: Output) {
        this.numUses = value
    }

    /**
     * @param value The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
     */
    @JvmName("pordqphgnermuvdu")
    public suspend fun period(`value`: Output) {
        this.period = value
    }

    /**
     * @param value List of policies to attach to this token
     */
    @JvmName("ymbwlkumbjpkhntr")
    public suspend fun policies(`value`: Output>) {
        this.policies = value
    }

    @JvmName("krlikioakqqhprtt")
    public suspend fun policies(vararg values: Output) {
        this.policies = Output.all(values.asList())
    }

    /**
     * @param values List of policies to attach to this token
     */
    @JvmName("qwihjqorvwbsasix")
    public suspend fun policies(values: List>) {
        this.policies = Output.all(values)
    }

    /**
     * @param value The renew increment. This is specified in seconds
     */
    @JvmName("vyobtvvxrbxkfvgg")
    public suspend fun renewIncrement(`value`: Output) {
        this.renewIncrement = value
    }

    /**
     * @param value The minimal lease to renew this token
     */
    @JvmName("iqmxhcmqrpghmwwa")
    public suspend fun renewMinLease(`value`: Output) {
        this.renewMinLease = value
    }

    /**
     * @param value Flag to allow to renew this token
     */
    @JvmName("vtdouileglvvidin")
    public suspend fun renewable(`value`: Output) {
        this.renewable = value
    }

    /**
     * @param value The token role name
     */
    @JvmName("fhqcxgmmloewtjoc")
    public suspend fun roleName(`value`: Output) {
        this.roleName = value
    }

    /**
     * @param value The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
     */
    @JvmName("troshyihnxdcjsyl")
    public suspend fun ttl(`value`: Output) {
        this.ttl = value
    }

    /**
     * @param value The TTL period of the wrapped token.
     */
    @JvmName("ecbhobldouvotluc")
    public suspend fun wrappingTtl(`value`: Output) {
        this.wrappingTtl = value
    }

    /**
     * @param value String containing the token display name
     */
    @JvmName("ngqfntyteexuxxsn")
    public suspend fun displayName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.displayName = mapped
    }

    /**
     * @param value The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
     */
    @JvmName("vnkbyetcsyxnjsqk")
    public suspend fun explicitMaxTtl(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.explicitMaxTtl = mapped
    }

    /**
     * @param value Metadata to be set on this token
     */
    @JvmName("gkodvdpxpjxmtyhx")
    public suspend fun metadata(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.metadata = mapped
    }

    /**
     * @param values Metadata to be set on this token
     */
    @JvmName("hgammlifmwgwpurv")
    public fun metadata(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.metadata = 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("xrntovvkrkuyboxb")
    public suspend fun namespace(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.namespace = mapped
    }

    /**
     * @param value Flag to not attach the default policy to this token
     */
    @JvmName("wsnjyrgejbmwrlbr")
    public suspend fun noDefaultPolicy(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.noDefaultPolicy = mapped
    }

    /**
     * @param value Flag to create a token without parent
     */
    @JvmName("sonqbdwneaxncpti")
    public suspend fun noParent(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.noParent = mapped
    }

    /**
     * @param value The number of allowed uses of this token
     */
    @JvmName("gibatiwgeybddgpo")
    public suspend fun numUses(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.numUses = mapped
    }

    /**
     * @param value The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
     */
    @JvmName("oubotwvcotxodydg")
    public suspend fun period(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.period = mapped
    }

    /**
     * @param value List of policies to attach to this token
     */
    @JvmName("wjnerifayrbevfml")
    public suspend fun policies(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.policies = mapped
    }

    /**
     * @param values List of policies to attach to this token
     */
    @JvmName("iwvwfcpjsenclwfa")
    public suspend fun policies(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.policies = mapped
    }

    /**
     * @param value The renew increment. This is specified in seconds
     */
    @JvmName("gbnsepnlesspcdhr")
    public suspend fun renewIncrement(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.renewIncrement = mapped
    }

    /**
     * @param value The minimal lease to renew this token
     */
    @JvmName("ilbdbojulfjakski")
    public suspend fun renewMinLease(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.renewMinLease = mapped
    }

    /**
     * @param value Flag to allow to renew this token
     */
    @JvmName("kmjejvkvkwhgmgts")
    public suspend fun renewable(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.renewable = mapped
    }

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

    /**
     * @param value The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
     */
    @JvmName("isidwxypbgadqchl")
    public suspend fun ttl(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ttl = mapped
    }

    /**
     * @param value The TTL period of the wrapped token.
     */
    @JvmName("cvgvyjdkdeoohrog")
    public suspend fun wrappingTtl(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.wrappingTtl = mapped
    }

    internal fun build(): TokenArgs = TokenArgs(
        displayName = displayName,
        explicitMaxTtl = explicitMaxTtl,
        metadata = metadata,
        namespace = namespace,
        noDefaultPolicy = noDefaultPolicy,
        noParent = noParent,
        numUses = numUses,
        period = period,
        policies = policies,
        renewIncrement = renewIncrement,
        renewMinLease = renewMinLease,
        renewable = renewable,
        roleName = roleName,
        ttl = ttl,
        wrappingTtl = wrappingTtl,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy