com.pulumi.nomad.kotlin.Namespace.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-nomad-kotlin Show documentation
Show all versions of pulumi-nomad-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.nomad.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.nomad.kotlin.outputs.NamespaceCapabilities
import com.pulumi.nomad.kotlin.outputs.NamespaceNodePoolConfig
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.nomad.kotlin.outputs.NamespaceCapabilities.Companion.toKotlin as namespaceCapabilitiesToKotlin
import com.pulumi.nomad.kotlin.outputs.NamespaceNodePoolConfig.Companion.toKotlin as namespaceNodePoolConfigToKotlin
/**
* Builder for [Namespace].
*/
@PulumiTagMarker
public class NamespaceResourceBuilder internal constructor() {
public var name: String? = null
public var args: NamespaceArgs = NamespaceArgs()
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 NamespaceArgsBuilder.() -> Unit) {
val builder = NamespaceArgsBuilder()
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(): Namespace {
val builtJavaResource = com.pulumi.nomad.Namespace(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Namespace(builtJavaResource)
}
}
/**
* 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}
* ```
*
*/
public class Namespace internal constructor(
override val javaResource: com.pulumi.nomad.Namespace,
) : KotlinCustomResource(javaResource, NamespaceMapper) {
/**
* `(block: )` - A block of capabilities for the namespace. Can't
* be repeated. See below for the structure of this block.
*/
public val capabilities: Output?
get() = javaResource.capabilities().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
namespaceCapabilitiesToKotlin(args0)
})
}).orElse(null)
})
/**
* `(string: "")` - A description of the namespace.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* `(map[string]string: )` - Specifies arbitrary KV metadata to associate with the namespace.
*/
public val meta: Output