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

com.pulumi.nomad.kotlin.AclTokenArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.nomad.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.kotlin.applySuspend
import com.pulumi.nomad.AclTokenArgs.builder
import com.pulumi.nomad.kotlin.inputs.AclTokenRoleArgs
import com.pulumi.nomad.kotlin.inputs.AclTokenRoleArgsBuilder
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * ## Example Usage
 * Creating a token with limited policies:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as nomad from "@pulumi/nomad";
 * const dakota = new nomad.AclToken("dakota", {
 *     name: "Dakota",
 *     type: "client",
 *     policies: [
 *         "dev",
 *         "qa",
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_nomad as nomad
 * dakota = nomad.AclToken("dakota",
 *     name="Dakota",
 *     type="client",
 *     policies=[
 *         "dev",
 *         "qa",
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Nomad = Pulumi.Nomad;
 * return await Deployment.RunAsync(() =>
 * {
 *     var dakota = new Nomad.AclToken("dakota", new()
 *     {
 *         Name = "Dakota",
 *         Type = "client",
 *         Policies = new[]
 *         {
 *             "dev",
 *             "qa",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-nomad/sdk/v2/go/nomad"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := nomad.NewAclToken(ctx, "dakota", &nomad.AclTokenArgs{
 * 			Name: pulumi.String("Dakota"),
 * 			Type: pulumi.String("client"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("dev"),
 * 				pulumi.String("qa"),
 * 			},
 * 		})
 * 		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.nomad.AclToken;
 * import com.pulumi.nomad.AclTokenArgs;
 * 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 dakota = new AclToken("dakota", AclTokenArgs.builder()
 *             .name("Dakota")
 *             .type("client")
 *             .policies(
 *                 "dev",
 *                 "qa")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   dakota:
 *     type: nomad:AclToken
 *     properties:
 *       name: Dakota
 *       type: client
 *       policies:
 *         - dev
 *         - qa
 * ```
 * 
 * Creating a global token that will be replicated to all regions:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as nomad from "@pulumi/nomad";
 * const dakota = new nomad.AclToken("dakota", {
 *     name: "Dakota",
 *     type: "client",
 *     policies: [
 *         "dev",
 *         "qa",
 *     ],
 *     global: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_nomad as nomad
 * dakota = nomad.AclToken("dakota",
 *     name="Dakota",
 *     type="client",
 *     policies=[
 *         "dev",
 *         "qa",
 *     ],
 *     global_=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Nomad = Pulumi.Nomad;
 * return await Deployment.RunAsync(() =>
 * {
 *     var dakota = new Nomad.AclToken("dakota", new()
 *     {
 *         Name = "Dakota",
 *         Type = "client",
 *         Policies = new[]
 *         {
 *             "dev",
 *             "qa",
 *         },
 *         Global = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-nomad/sdk/v2/go/nomad"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := nomad.NewAclToken(ctx, "dakota", &nomad.AclTokenArgs{
 * 			Name: pulumi.String("Dakota"),
 * 			Type: pulumi.String("client"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("dev"),
 * 				pulumi.String("qa"),
 * 			},
 * 			Global: 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.nomad.AclToken;
 * import com.pulumi.nomad.AclTokenArgs;
 * 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 dakota = new AclToken("dakota", AclTokenArgs.builder()
 *             .name("Dakota")
 *             .type("client")
 *             .policies(
 *                 "dev",
 *                 "qa")
 *             .global(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   dakota:
 *     type: nomad:AclToken
 *     properties:
 *       name: Dakota
 *       type: client
 *       policies:
 *         - dev
 *         - qa
 *       global: true
 * ```
 * 
 * Creating a token with full access to the cluster:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as nomad from "@pulumi/nomad";
 * const iman = new nomad.AclToken("iman", {
 *     name: "Iman",
 *     type: "management",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_nomad as nomad
 * iman = nomad.AclToken("iman",
 *     name="Iman",
 *     type="management")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Nomad = Pulumi.Nomad;
 * return await Deployment.RunAsync(() =>
 * {
 *     var iman = new Nomad.AclToken("iman", new()
 *     {
 *         Name = "Iman",
 *         Type = "management",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-nomad/sdk/v2/go/nomad"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := nomad.NewAclToken(ctx, "iman", &nomad.AclTokenArgs{
 * 			Name: pulumi.String("Iman"),
 * 			Type: pulumi.String("management"),
 * 		})
 * 		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.nomad.AclToken;
 * import com.pulumi.nomad.AclTokenArgs;
 * 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 iman = new AclToken("iman", AclTokenArgs.builder()
 *             .name("Iman")
 *             .type("management")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   iman:
 *     type: nomad:AclToken
 *     properties:
 *       name: Iman
 *       type: management
 * ```
 * 
 * Accessing the token:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as nomad from "@pulumi/nomad";
 * const token = new nomad.AclToken("token", {
 *     type: "client",
 *     policies: ["dev"],
 * });
 * export const nomadToken = token.secretId;
 * ```
 * ```python
 * import pulumi
 * import pulumi_nomad as nomad
 * token = nomad.AclToken("token",
 *     type="client",
 *     policies=["dev"])
 * pulumi.export("nomadToken", token.secret_id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Nomad = Pulumi.Nomad;
 * return await Deployment.RunAsync(() =>
 * {
 *     var token = new Nomad.AclToken("token", new()
 *     {
 *         Type = "client",
 *         Policies = new[]
 *         {
 *             "dev",
 *         },
 *     });
 *     return new Dictionary
 *     {
 *         ["nomadToken"] = token.SecretId,
 *     };
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-nomad/sdk/v2/go/nomad"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		token, err := nomad.NewAclToken(ctx, "token", &nomad.AclTokenArgs{
 * 			Type: pulumi.String("client"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("dev"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		ctx.Export("nomadToken", token.SecretId)
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.nomad.AclToken;
 * import com.pulumi.nomad.AclTokenArgs;
 * 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 token = new AclToken("token", AclTokenArgs.builder()
 *             .type("client")
 *             .policies("dev")
 *             .build());
 *         ctx.export("nomadToken", token.secretId());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   token:
 *     type: nomad:AclToken
 *     properties:
 *       type: client
 *       policies:
 *         - dev
 * outputs:
 *   nomadToken: ${token.secretId}
 * ```
 * 
 * @property expirationTtl `(string: "")` - Provides a TTL for the token in the form of
 * a time duration such as `"5m"` or `"1h"`.
 * In addition to the above arguments, the following attributes are exported and
 * can be referenced:
 * @property global `(bool: false)` - Whether the token should be replicated to all
 * regions, or if it will only be used in the region it was created in.
 * @property name `(string: "")` - A human-friendly name for this token.
 * @property policies `(set: [])` - A set of policy names to associate with this
 * token. Must be set on `client`-type tokens, must not be set on
 * `management`-type tokens. Policies do not need to exist before being
 * used here.
 * @property roles `(set: [])` - The list of roles attached to the token. Each entry has
 * `name` and `id` attributes. It may be used multiple times.
 * @property type `(string: )` - The type of token this is. Use `client`
 * for tokens that will have policies associated with them. Use `management`
 * for tokens that can perform any action.
 */
public data class AclTokenArgs(
    public val expirationTtl: Output? = null,
    public val global: Output? = null,
    public val name: Output? = null,
    public val policies: Output>? = null,
    public val roles: Output>? = null,
    public val type: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.nomad.AclTokenArgs = com.pulumi.nomad.AclTokenArgs.builder()
        .expirationTtl(expirationTtl?.applyValue({ args0 -> args0 }))
        .global(global?.applyValue({ args0 -> args0 }))
        .name(name?.applyValue({ args0 -> args0 }))
        .policies(policies?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
        .roles(roles?.applyValue({ args0 -> args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) }) }))
        .type(type?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [AclTokenArgs].
 */
@PulumiTagMarker
public class AclTokenArgsBuilder internal constructor() {
    private var expirationTtl: Output? = null

    private var global: Output? = null

    private var name: Output? = null

    private var policies: Output>? = null

    private var roles: Output>? = null

    private var type: Output? = null

    /**
     * @param value `(string: "")` - Provides a TTL for the token in the form of
     * a time duration such as `"5m"` or `"1h"`.
     * In addition to the above arguments, the following attributes are exported and
     * can be referenced:
     */
    @JvmName("owdllgqksqiygvyv")
    public suspend fun expirationTtl(`value`: Output) {
        this.expirationTtl = value
    }

    /**
     * @param value `(bool: false)` - Whether the token should be replicated to all
     * regions, or if it will only be used in the region it was created in.
     */
    @JvmName("cvjiatmhcexelyvv")
    public suspend fun global(`value`: Output) {
        this.global = value
    }

    /**
     * @param value `(string: "")` - A human-friendly name for this token.
     */
    @JvmName("nddtnqbhavniahtq")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value `(set: [])` - A set of policy names to associate with this
     * token. Must be set on `client`-type tokens, must not be set on
     * `management`-type tokens. Policies do not need to exist before being
     * used here.
     */
    @JvmName("rsfwxvhfwogsvcsw")
    public suspend fun policies(`value`: Output>) {
        this.policies = value
    }

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

    /**
     * @param values `(set: [])` - A set of policy names to associate with this
     * token. Must be set on `client`-type tokens, must not be set on
     * `management`-type tokens. Policies do not need to exist before being
     * used here.
     */
    @JvmName("usgvfhabseruuihl")
    public suspend fun policies(values: List>) {
        this.policies = Output.all(values)
    }

    /**
     * @param value `(set: [])` - The list of roles attached to the token. Each entry has
     * `name` and `id` attributes. It may be used multiple times.
     */
    @JvmName("tcxmavthiityqewu")
    public suspend fun roles(`value`: Output>) {
        this.roles = value
    }

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

    /**
     * @param values `(set: [])` - The list of roles attached to the token. Each entry has
     * `name` and `id` attributes. It may be used multiple times.
     */
    @JvmName("vybmfmbbyjmpjkvf")
    public suspend fun roles(values: List>) {
        this.roles = Output.all(values)
    }

    /**
     * @param value `(string: )` - The type of token this is. Use `client`
     * for tokens that will have policies associated with them. Use `management`
     * for tokens that can perform any action.
     */
    @JvmName("orqwfqsxymlhrhlj")
    public suspend fun type(`value`: Output) {
        this.type = value
    }

    /**
     * @param value `(string: "")` - Provides a TTL for the token in the form of
     * a time duration such as `"5m"` or `"1h"`.
     * In addition to the above arguments, the following attributes are exported and
     * can be referenced:
     */
    @JvmName("qubqllnisnguqail")
    public suspend fun expirationTtl(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.expirationTtl = mapped
    }

    /**
     * @param value `(bool: false)` - Whether the token should be replicated to all
     * regions, or if it will only be used in the region it was created in.
     */
    @JvmName("cafwmrbveoqmmyvu")
    public suspend fun global(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.global = mapped
    }

    /**
     * @param value `(string: "")` - A human-friendly name for this token.
     */
    @JvmName("fdfvagvchxsdiwkh")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value `(set: [])` - A set of policy names to associate with this
     * token. Must be set on `client`-type tokens, must not be set on
     * `management`-type tokens. Policies do not need to exist before being
     * used here.
     */
    @JvmName("hcnmrxlkwhxvlqab")
    public suspend fun policies(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.policies = mapped
    }

    /**
     * @param values `(set: [])` - A set of policy names to associate with this
     * token. Must be set on `client`-type tokens, must not be set on
     * `management`-type tokens. Policies do not need to exist before being
     * used here.
     */
    @JvmName("owurpdqtdiddkhlo")
    public suspend fun policies(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.policies = mapped
    }

    /**
     * @param value `(set: [])` - The list of roles attached to the token. Each entry has
     * `name` and `id` attributes. It may be used multiple times.
     */
    @JvmName("edrakrmbyneigmbi")
    public suspend fun roles(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.roles = mapped
    }

    /**
     * @param argument `(set: [])` - The list of roles attached to the token. Each entry has
     * `name` and `id` attributes. It may be used multiple times.
     */
    @JvmName("ytxfiuphjnpfnmqh")
    public suspend fun roles(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            AclTokenRoleArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.roles = mapped
    }

    /**
     * @param argument `(set: [])` - The list of roles attached to the token. Each entry has
     * `name` and `id` attributes. It may be used multiple times.
     */
    @JvmName("xqiqexdvpdflqjba")
    public suspend fun roles(vararg argument: suspend AclTokenRoleArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            AclTokenRoleArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.roles = mapped
    }

    /**
     * @param argument `(set: [])` - The list of roles attached to the token. Each entry has
     * `name` and `id` attributes. It may be used multiple times.
     */
    @JvmName("kwkmthqsgkroxvms")
    public suspend fun roles(argument: suspend AclTokenRoleArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(AclTokenRoleArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.roles = mapped
    }

    /**
     * @param values `(set: [])` - The list of roles attached to the token. Each entry has
     * `name` and `id` attributes. It may be used multiple times.
     */
    @JvmName("ollgawvacnrdkjft")
    public suspend fun roles(vararg values: AclTokenRoleArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.roles = mapped
    }

    /**
     * @param value `(string: )` - The type of token this is. Use `client`
     * for tokens that will have policies associated with them. Use `management`
     * for tokens that can perform any action.
     */
    @JvmName("rfqaxfskqsmqfrfd")
    public suspend fun type(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.type = mapped
    }

    internal fun build(): AclTokenArgs = AclTokenArgs(
        expirationTtl = expirationTtl,
        global = global,
        name = name,
        policies = policies,
        roles = roles,
        type = type,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy