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

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

@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.NodePoolSchedulerConfig
import com.pulumi.nomad.kotlin.outputs.NodePoolSchedulerConfig.Companion.toKotlin
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map

/**
 * Builder for [NodePool].
 */
@PulumiTagMarker
public class NodePoolResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: NodePoolArgs = NodePoolArgs()

    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 NodePoolArgsBuilder.() -> Unit) {
        val builder = NodePoolArgsBuilder()
        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(): NodePool {
        val builtJavaResource = com.pulumi.nomad.NodePool(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return NodePool(builtJavaResource)
    }
}

/**
 * Provisions a node pool within a Nomad cluster.
 * ## Example Usage
 * Registering a node pool:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as nomad from "@pulumi/nomad";
 * const dev = new nomad.NodePool("dev", {
 *     name: "dev",
 *     description: "Nodes for the development environment.",
 *     meta: {
 *         department: "Engineering",
 *         env: "dev",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_nomad as nomad
 * dev = nomad.NodePool("dev",
 *     name="dev",
 *     description="Nodes for the development environment.",
 *     meta={
 *         "department": "Engineering",
 *         "env": "dev",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Nomad = Pulumi.Nomad;
 * return await Deployment.RunAsync(() =>
 * {
 *     var dev = new Nomad.NodePool("dev", new()
 *     {
 *         Name = "dev",
 *         Description = "Nodes for the development environment.",
 *         Meta =
 *         {
 *             { "department", "Engineering" },
 *             { "env", "dev" },
 *         },
 *     });
 * });
 * ```
 * ```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.NewNodePool(ctx, "dev", &nomad.NodePoolArgs{
 * 			Name:        pulumi.String("dev"),
 * 			Description: pulumi.String("Nodes for the development environment."),
 * 			Meta: pulumi.StringMap{
 * 				"department": pulumi.String("Engineering"),
 * 				"env":        pulumi.String("dev"),
 * 			},
 * 		})
 * 		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.NodePool;
 * import com.pulumi.nomad.NodePoolArgs;
 * 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 NodePool("dev", NodePoolArgs.builder()
 *             .name("dev")
 *             .description("Nodes for the development environment.")
 *             .meta(Map.ofEntries(
 *                 Map.entry("department", "Engineering"),
 *                 Map.entry("env", "dev")
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   dev:
 *     type: nomad:NodePool
 *     properties:
 *       name: dev
 *       description: Nodes for the development environment.
 *       meta:
 *         department: Engineering
 *         env: dev
 * ```
 * 
 */
public class NodePool internal constructor(
    override val javaResource: com.pulumi.nomad.NodePool,
) : KotlinCustomResource(javaResource, NodePoolMapper) {
    /**
     * `(string)` - The description of the node pool.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * `(map[string]string)` - Arbitrary KV metadata associated with the
     * node pool.
     */
    public val meta: Output>?
        get() = javaResource.meta().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * `(string)` - The name of the node pool.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * `(block)` - Scheduler configuration for the node pool.
     */
    public val schedulerConfig: Output?
        get() = javaResource.schedulerConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            }).orElse(null)
        })
}

public object NodePoolMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.nomad.NodePool::class == javaResource::class

    override fun map(javaResource: Resource): NodePool = NodePool(
        javaResource as
            com.pulumi.nomad.NodePool,
    )
}

/**
 * @see [NodePool].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [NodePool].
 */
public suspend fun nodePool(name: String, block: suspend NodePoolResourceBuilder.() -> Unit): NodePool {
    val builder = NodePoolResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [NodePool].
 * @param name The _unique_ name of the resulting resource.
 */
public fun nodePool(name: String): NodePool {
    val builder = NodePoolResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy