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

com.pulumi.nomad.kotlin.NamespaceArgs.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.NamespaceArgs.builder
import com.pulumi.nomad.kotlin.inputs.NamespaceCapabilitiesArgs
import com.pulumi.nomad.kotlin.inputs.NamespaceCapabilitiesArgsBuilder
import com.pulumi.nomad.kotlin.inputs.NamespaceNodePoolConfigArgs
import com.pulumi.nomad.kotlin.inputs.NamespaceNodePoolConfigArgsBuilder
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Provisions a namespace within a Nomad cluster.
 * Nomad auto-generates a default namespace called `default`. This namespace
 * cannot be removed, so destroying a `nomad.Namespace` resource where
 * `name = "default"` will cause the namespace to be reset to its default
 * configuration.
 * ## Example Usage
 * Registering a namespace:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as nomad from "@pulumi/nomad";
 * const dev = new nomad.Namespace("dev", {
 *     name: "dev",
 *     description: "Shared development environment.",
 *     quota: "dev",
 *     meta: {
 *         owner: "John Doe",
 *         foo: "bar",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_nomad as nomad
 * dev = nomad.Namespace("dev",
 *     name="dev",
 *     description="Shared development environment.",
 *     quota="dev",
 *     meta={
 *         "owner": "John Doe",
 *         "foo": "bar",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Nomad = Pulumi.Nomad;
 * return await Deployment.RunAsync(() =>
 * {
 *     var dev = new Nomad.Namespace("dev", new()
 *     {
 *         Name = "dev",
 *         Description = "Shared development environment.",
 *         Quota = "dev",
 *         Meta =
 *         {
 *             { "owner", "John Doe" },
 *             { "foo", "bar" },
 *         },
 *     });
 * });
 * ```
 * ```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.NewNamespace(ctx, "dev", &nomad.NamespaceArgs{
 * 			Name:        pulumi.String("dev"),
 * 			Description: pulumi.String("Shared development environment."),
 * 			Quota:       pulumi.String("dev"),
 * 			Meta: pulumi.StringMap{
 * 				"owner": pulumi.String("John Doe"),
 * 				"foo":   pulumi.String("bar"),
 * 			},
 * 		})
 * 		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.Namespace;
 * import com.pulumi.nomad.NamespaceArgs;
 * 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 dev = new Namespace("dev", NamespaceArgs.builder()
 *             .name("dev")
 *             .description("Shared development environment.")
 *             .quota("dev")
 *             .meta(Map.ofEntries(
 *                 Map.entry("owner", "John Doe"),
 *                 Map.entry("foo", "bar")
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   dev:
 *     type: nomad:Namespace
 *     properties:
 *       name: dev
 *       description: Shared development environment.
 *       quota: dev
 *       meta:
 *         owner: John Doe
 *         foo: bar
 * ```
 * 
 * Registering a namespace with a quota:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as nomad from "@pulumi/nomad";
 * const webTeam = new nomad.QuoteSpecification("web_team", {
 *     name: "web-team",
 *     description: "web team quota",
 *     limits: [{
 *         region: "global",
 *         regionLimit: {
 *             cpu: 1000,
 *             memoryMb: 256,
 *         },
 *     }],
 * });
 * const web = new nomad.Namespace("web", {
 *     name: "web",
 *     description: "Web team production environment.",
 *     quota: webTeam.name,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_nomad as nomad
 * web_team = nomad.QuoteSpecification("web_team",
 *     name="web-team",
 *     description="web team quota",
 *     limits=[{
 *         "region": "global",
 *         "region_limit": {
 *             "cpu": 1000,
 *             "memory_mb": 256,
 *         },
 *     }])
 * web = nomad.Namespace("web",
 *     name="web",
 *     description="Web team production environment.",
 *     quota=web_team.name)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Nomad = Pulumi.Nomad;
 * return await Deployment.RunAsync(() =>
 * {
 *     var webTeam = new Nomad.QuoteSpecification("web_team", new()
 *     {
 *         Name = "web-team",
 *         Description = "web team quota",
 *         Limits = new[]
 *         {
 *             new Nomad.Inputs.QuoteSpecificationLimitArgs
 *             {
 *                 Region = "global",
 *                 RegionLimit = new Nomad.Inputs.QuoteSpecificationLimitRegionLimitArgs
 *                 {
 *                     Cpu = 1000,
 *                     MemoryMb = 256,
 *                 },
 *             },
 *         },
 *     });
 *     var web = new Nomad.Namespace("web", new()
 *     {
 *         Name = "web",
 *         Description = "Web team production environment.",
 *         Quota = webTeam.Name,
 *     });
 * });
 * ```
 * ```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 {
 * 		webTeam, err := nomad.NewQuoteSpecification(ctx, "web_team", &nomad.QuoteSpecificationArgs{
 * 			Name:        pulumi.String("web-team"),
 * 			Description: pulumi.String("web team quota"),
 * 			Limits: nomad.QuoteSpecificationLimitArray{
 * 				&nomad.QuoteSpecificationLimitArgs{
 * 					Region: pulumi.String("global"),
 * 					RegionLimit: &nomad.QuoteSpecificationLimitRegionLimitArgs{
 * 						Cpu:      pulumi.Int(1000),
 * 						MemoryMb: pulumi.Int(256),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = nomad.NewNamespace(ctx, "web", &nomad.NamespaceArgs{
 * 			Name:        pulumi.String("web"),
 * 			Description: pulumi.String("Web team production environment."),
 * 			Quota:       webTeam.Name,
 * 		})
 * 		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.QuoteSpecification;
 * import com.pulumi.nomad.QuoteSpecificationArgs;
 * import com.pulumi.nomad.inputs.QuoteSpecificationLimitArgs;
 * import com.pulumi.nomad.inputs.QuoteSpecificationLimitRegionLimitArgs;
 * import com.pulumi.nomad.Namespace;
 * import com.pulumi.nomad.NamespaceArgs;
 * 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 webTeam = new QuoteSpecification("webTeam", QuoteSpecificationArgs.builder()
 *             .name("web-team")
 *             .description("web team quota")
 *             .limits(QuoteSpecificationLimitArgs.builder()
 *                 .region("global")
 *                 .regionLimit(QuoteSpecificationLimitRegionLimitArgs.builder()
 *                     .cpu(1000)
 *                     .memoryMb(256)
 *                     .build())
 *                 .build())
 *             .build());
 *         var web = new Namespace("web", NamespaceArgs.builder()
 *             .name("web")
 *             .description("Web team production environment.")
 *             .quota(webTeam.name())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   webTeam:
 *     type: nomad:QuoteSpecification
 *     name: web_team
 *     properties:
 *       name: web-team
 *       description: web team quota
 *       limits:
 *         - region: global
 *           regionLimit:
 *             cpu: 1000
 *             memoryMb: 256
 *   web:
 *     type: nomad:Namespace
 *     properties:
 *       name: web
 *       description: Web team production environment.
 *       quota: ${webTeam.name}
 * ```
 * 
 * @property capabilities `(block: )` - A block of capabilities for the namespace. Can't
 * be repeated. See below for the structure of this block.
 * @property description `(string: "")` - A description of the namespace.
 * @property meta `(map[string]string: )` -  Specifies arbitrary KV metadata to associate with the namespace.
 * @property name `(string: )` - A unique name for the namespace.
 * @property nodePoolConfig `(block: )` - A block with node pool configuration for the namespace (Nomad Enterprise only).
 * @property quota `(string: "")` - A resource quota to attach to the namespace.
 */
public data class NamespaceArgs(
    public val capabilities: Output? = null,
    public val description: Output? = null,
    public val meta: Output>? = null,
    public val name: Output? = null,
    public val nodePoolConfig: Output? = null,
    public val quota: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.nomad.NamespaceArgs = com.pulumi.nomad.NamespaceArgs.builder()
        .capabilities(capabilities?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
        .description(description?.applyValue({ args0 -> args0 }))
        .meta(meta?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
        .name(name?.applyValue({ args0 -> args0 }))
        .nodePoolConfig(nodePoolConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
        .quota(quota?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [NamespaceArgs].
 */
@PulumiTagMarker
public class NamespaceArgsBuilder internal constructor() {
    private var capabilities: Output? = null

    private var description: Output? = null

    private var meta: Output>? = null

    private var name: Output? = null

    private var nodePoolConfig: Output? = null

    private var quota: Output? = null

    /**
     * @param value `(block: )` - A block of capabilities for the namespace. Can't
     * be repeated. See below for the structure of this block.
     */
    @JvmName("dltfvmseulvsdubn")
    public suspend fun capabilities(`value`: Output) {
        this.capabilities = value
    }

    /**
     * @param value `(string: "")` - A description of the namespace.
     */
    @JvmName("gcvkblsrucvlioeg")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value `(map[string]string: )` -  Specifies arbitrary KV metadata to associate with the namespace.
     */
    @JvmName("hpngwgmpgufwfiyb")
    public suspend fun meta(`value`: Output>) {
        this.meta = value
    }

    /**
     * @param value `(string: )` - A unique name for the namespace.
     */
    @JvmName("fvsjxteoxscwqhex")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value `(block: )` - A block with node pool configuration for the namespace (Nomad Enterprise only).
     */
    @JvmName("hackqkshcyyyanhe")
    public suspend fun nodePoolConfig(`value`: Output) {
        this.nodePoolConfig = value
    }

    /**
     * @param value `(string: "")` - A resource quota to attach to the namespace.
     */
    @JvmName("iuktepoigmnvurmc")
    public suspend fun quota(`value`: Output) {
        this.quota = value
    }

    /**
     * @param value `(block: )` - A block of capabilities for the namespace. Can't
     * be repeated. See below for the structure of this block.
     */
    @JvmName("opxrwalyuxgldbwr")
    public suspend fun capabilities(`value`: NamespaceCapabilitiesArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.capabilities = mapped
    }

    /**
     * @param argument `(block: )` - A block of capabilities for the namespace. Can't
     * be repeated. See below for the structure of this block.
     */
    @JvmName("jotbcrlrpsegnfto")
    public suspend fun capabilities(argument: suspend NamespaceCapabilitiesArgsBuilder.() -> Unit) {
        val toBeMapped = NamespaceCapabilitiesArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.capabilities = mapped
    }

    /**
     * @param value `(string: "")` - A description of the namespace.
     */
    @JvmName("dcyhwnxkrfqmejhe")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value `(map[string]string: )` -  Specifies arbitrary KV metadata to associate with the namespace.
     */
    @JvmName("oudpaadubaegxfme")
    public suspend fun meta(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.meta = mapped
    }

    /**
     * @param values `(map[string]string: )` -  Specifies arbitrary KV metadata to associate with the namespace.
     */
    @JvmName("nabcpnnehnsmapyt")
    public fun meta(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.meta = mapped
    }

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

    /**
     * @param value `(block: )` - A block with node pool configuration for the namespace (Nomad Enterprise only).
     */
    @JvmName("pjhtfkjvorwfaucp")
    public suspend fun nodePoolConfig(`value`: NamespaceNodePoolConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.nodePoolConfig = mapped
    }

    /**
     * @param argument `(block: )` - A block with node pool configuration for the namespace (Nomad Enterprise only).
     */
    @JvmName("pyklabhjcllqmdqg")
    public suspend fun nodePoolConfig(argument: suspend NamespaceNodePoolConfigArgsBuilder.() -> Unit) {
        val toBeMapped = NamespaceNodePoolConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.nodePoolConfig = mapped
    }

    /**
     * @param value `(string: "")` - A resource quota to attach to the namespace.
     */
    @JvmName("ylrdcpslsrdsuafi")
    public suspend fun quota(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.quota = mapped
    }

    internal fun build(): NamespaceArgs = NamespaceArgs(
        capabilities = capabilities,
        description = description,
        meta = meta,
        name = name,
        nodePoolConfig = nodePoolConfig,
        quota = quota,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy