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

com.pulumi.nomad.kotlin.SchedulerConfigArgs.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: 2.4.0.0
Show newest version
@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.nomad.SchedulerConfigArgs.builder
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages scheduler configuration of the Nomad cluster.
 * > **Warning:** destroying this resource will not have any effect in the
 * cluster configuration, since there's no clear definition of what a destroy
 * action should do. The cluster will be left as-is and only the state reference
 * will be removed.
 * ## Example Usage
 * Set cluster scheduler configuration:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as nomad from "@pulumi/nomad";
 * const config = new nomad.SchedulerConfig("config", {
 *     schedulerAlgorithm: "spread",
 *     memoryOversubscriptionEnabled: true,
 *     preemptionConfig: {
 *         system_scheduler_enabled: true,
 *         batch_scheduler_enabled: true,
 *         service_scheduler_enabled: true,
 *         sysbatch_scheduler_enabled: true,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_nomad as nomad
 * config = nomad.SchedulerConfig("config",
 *     scheduler_algorithm="spread",
 *     memory_oversubscription_enabled=True,
 *     preemption_config={
 *         "system_scheduler_enabled": True,
 *         "batch_scheduler_enabled": True,
 *         "service_scheduler_enabled": True,
 *         "sysbatch_scheduler_enabled": True,
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Nomad = Pulumi.Nomad;
 * return await Deployment.RunAsync(() =>
 * {
 *     var config = new Nomad.SchedulerConfig("config", new()
 *     {
 *         SchedulerAlgorithm = "spread",
 *         MemoryOversubscriptionEnabled = true,
 *         PreemptionConfig =
 *         {
 *             { "system_scheduler_enabled", true },
 *             { "batch_scheduler_enabled", true },
 *             { "service_scheduler_enabled", true },
 *             { "sysbatch_scheduler_enabled", 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.NewSchedulerConfig(ctx, "config", &nomad.SchedulerConfigArgs{
 * 			SchedulerAlgorithm:            pulumi.String("spread"),
 * 			MemoryOversubscriptionEnabled: pulumi.Bool(true),
 * 			PreemptionConfig: pulumi.BoolMap{
 * 				"system_scheduler_enabled":   pulumi.Bool(true),
 * 				"batch_scheduler_enabled":    pulumi.Bool(true),
 * 				"service_scheduler_enabled":  pulumi.Bool(true),
 * 				"sysbatch_scheduler_enabled": 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.SchedulerConfig;
 * import com.pulumi.nomad.SchedulerConfigArgs;
 * 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 config = new SchedulerConfig("config", SchedulerConfigArgs.builder()
 *             .schedulerAlgorithm("spread")
 *             .memoryOversubscriptionEnabled(true)
 *             .preemptionConfig(Map.ofEntries(
 *                 Map.entry("system_scheduler_enabled", true),
 *                 Map.entry("batch_scheduler_enabled", true),
 *                 Map.entry("service_scheduler_enabled", true),
 *                 Map.entry("sysbatch_scheduler_enabled", true)
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   config:
 *     type: nomad:SchedulerConfig
 *     properties:
 *       schedulerAlgorithm: spread
 *       memoryOversubscriptionEnabled: true
 *       preemptionConfig:
 *         system_scheduler_enabled: true
 *         batch_scheduler_enabled: true
 *         service_scheduler_enabled: true
 *         sysbatch_scheduler_enabled: true
 * ```
 * 
 * @property memoryOversubscriptionEnabled `(bool: false)` - When `true`, tasks may exceed their reserved memory limit.
 * @property preemptionConfig `(map[string]bool)` - Options to enable preemption for various schedulers.
 * @property schedulerAlgorithm `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are `binpack` and `spread`.
 */
public data class SchedulerConfigArgs(
    public val memoryOversubscriptionEnabled: Output? = null,
    public val preemptionConfig: Output>? = null,
    public val schedulerAlgorithm: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.nomad.SchedulerConfigArgs =
        com.pulumi.nomad.SchedulerConfigArgs.builder()
            .memoryOversubscriptionEnabled(memoryOversubscriptionEnabled?.applyValue({ args0 -> args0 }))
            .preemptionConfig(
                preemptionConfig?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .schedulerAlgorithm(schedulerAlgorithm?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SchedulerConfigArgs].
 */
@PulumiTagMarker
public class SchedulerConfigArgsBuilder internal constructor() {
    private var memoryOversubscriptionEnabled: Output? = null

    private var preemptionConfig: Output>? = null

    private var schedulerAlgorithm: Output? = null

    /**
     * @param value `(bool: false)` - When `true`, tasks may exceed their reserved memory limit.
     */
    @JvmName("dapfrajgtbtxnjyn")
    public suspend fun memoryOversubscriptionEnabled(`value`: Output) {
        this.memoryOversubscriptionEnabled = value
    }

    /**
     * @param value `(map[string]bool)` - Options to enable preemption for various schedulers.
     */
    @JvmName("fxmwstitedwmybal")
    public suspend fun preemptionConfig(`value`: Output>) {
        this.preemptionConfig = value
    }

    /**
     * @param value `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are `binpack` and `spread`.
     */
    @JvmName("ktvncjfglilnmyij")
    public suspend fun schedulerAlgorithm(`value`: Output) {
        this.schedulerAlgorithm = value
    }

    /**
     * @param value `(bool: false)` - When `true`, tasks may exceed their reserved memory limit.
     */
    @JvmName("ffjwpbrofhdmwqdm")
    public suspend fun memoryOversubscriptionEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.memoryOversubscriptionEnabled = mapped
    }

    /**
     * @param value `(map[string]bool)` - Options to enable preemption for various schedulers.
     */
    @JvmName("vtpvbisfhchoesoi")
    public suspend fun preemptionConfig(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.preemptionConfig = mapped
    }

    /**
     * @param values `(map[string]bool)` - Options to enable preemption for various schedulers.
     */
    @JvmName("mbuwbjjoqcopkhiu")
    public fun preemptionConfig(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.preemptionConfig = mapped
    }

    /**
     * @param value `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are `binpack` and `spread`.
     */
    @JvmName("aixfemgwjbqoudnk")
    public suspend fun schedulerAlgorithm(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.schedulerAlgorithm = mapped
    }

    internal fun build(): SchedulerConfigArgs = SchedulerConfigArgs(
        memoryOversubscriptionEnabled = memoryOversubscriptionEnabled,
        preemptionConfig = preemptionConfig,
        schedulerAlgorithm = schedulerAlgorithm,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy