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

com.pulumi.azurenative.batch.kotlin.inputs.StartTaskArgs.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.82.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azurenative.batch.kotlin.inputs

import com.pulumi.azurenative.batch.inputs.StartTaskArgs.builder
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 kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * In some cases the start task may be re-run even though the node was not rebooted. Due to this, start tasks should be idempotent and exit gracefully if the setup they're performing has already been done. Special care should be taken to avoid start tasks which create breakaway process or install/launch services from the start task working directory, as this will block Batch from being able to re-run the start task.
 * @property commandLine The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified.
 * @property containerSettings When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.
 * @property environmentSettings
 * @property maxTaskRetryCount The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit. Default is 0.
 * @property resourceFiles
 * @property userIdentity If omitted, the task runs as a non-administrative user unique to the task.
 * @property waitForSuccess If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true.
 */
public data class StartTaskArgs(
    public val commandLine: Output? = null,
    public val containerSettings: Output? = null,
    public val environmentSettings: Output>? = null,
    public val maxTaskRetryCount: Output? = null,
    public val resourceFiles: Output>? = null,
    public val userIdentity: Output? = null,
    public val waitForSuccess: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azurenative.batch.inputs.StartTaskArgs =
        com.pulumi.azurenative.batch.inputs.StartTaskArgs.builder()
            .commandLine(commandLine?.applyValue({ args0 -> args0 }))
            .containerSettings(containerSettings?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .environmentSettings(
                environmentSettings?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .maxTaskRetryCount(maxTaskRetryCount?.applyValue({ args0 -> args0 }))
            .resourceFiles(
                resourceFiles?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .userIdentity(userIdentity?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .waitForSuccess(waitForSuccess?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [StartTaskArgs].
 */
@PulumiTagMarker
public class StartTaskArgsBuilder internal constructor() {
    private var commandLine: Output? = null

    private var containerSettings: Output? = null

    private var environmentSettings: Output>? = null

    private var maxTaskRetryCount: Output? = null

    private var resourceFiles: Output>? = null

    private var userIdentity: Output? = null

    private var waitForSuccess: Output? = null

    /**
     * @param value The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified.
     */
    @JvmName("ndnorpeycdhppkem")
    public suspend fun commandLine(`value`: Output) {
        this.commandLine = value
    }

    /**
     * @param value When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.
     */
    @JvmName("aycwwbjupvbprmlb")
    public suspend fun containerSettings(`value`: Output) {
        this.containerSettings = value
    }

    /**
     * @param value
     */
    @JvmName("psmnbueusyfwephy")
    public suspend fun environmentSettings(`value`: Output>) {
        this.environmentSettings = value
    }

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

    /**
     * @param values
     */
    @JvmName("wiusbgekhonndjhe")
    public suspend fun environmentSettings(values: List>) {
        this.environmentSettings = Output.all(values)
    }

    /**
     * @param value The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit. Default is 0.
     */
    @JvmName("ukrumlyjxsssbyhp")
    public suspend fun maxTaskRetryCount(`value`: Output) {
        this.maxTaskRetryCount = value
    }

    /**
     * @param value
     */
    @JvmName("tpsaevhhwkimkobr")
    public suspend fun resourceFiles(`value`: Output>) {
        this.resourceFiles = value
    }

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

    /**
     * @param values
     */
    @JvmName("ciepkktwododdkbq")
    public suspend fun resourceFiles(values: List>) {
        this.resourceFiles = Output.all(values)
    }

    /**
     * @param value If omitted, the task runs as a non-administrative user unique to the task.
     */
    @JvmName("vtrdboearnfhrmfl")
    public suspend fun userIdentity(`value`: Output) {
        this.userIdentity = value
    }

    /**
     * @param value If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true.
     */
    @JvmName("xhkdxctltkymwgdi")
    public suspend fun waitForSuccess(`value`: Output) {
        this.waitForSuccess = value
    }

    /**
     * @param value The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified.
     */
    @JvmName("yxmtkssmatngkekh")
    public suspend fun commandLine(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.commandLine = mapped
    }

    /**
     * @param value When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.
     */
    @JvmName("efuyhhfjliugnpum")
    public suspend fun containerSettings(`value`: TaskContainerSettingsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.containerSettings = mapped
    }

    /**
     * @param argument When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.
     */
    @JvmName("raicjdblinfvmqjc")
    public suspend fun containerSettings(argument: suspend TaskContainerSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = TaskContainerSettingsArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.containerSettings = mapped
    }

    /**
     * @param value
     */
    @JvmName("qmdlwccxlnemhstd")
    public suspend fun environmentSettings(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.environmentSettings = mapped
    }

    /**
     * @param argument
     */
    @JvmName("txiuowcnavwgqcgw")
    public suspend fun environmentSettings(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            EnvironmentSettingArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.environmentSettings = mapped
    }

    /**
     * @param argument
     */
    @JvmName("vmdbdmtbndvenoil")
    public suspend fun environmentSettings(vararg argument: suspend EnvironmentSettingArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            EnvironmentSettingArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.environmentSettings = mapped
    }

    /**
     * @param argument
     */
    @JvmName("onetpowohkkqpjsd")
    public suspend fun environmentSettings(argument: suspend EnvironmentSettingArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(EnvironmentSettingArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.environmentSettings = mapped
    }

    /**
     * @param values
     */
    @JvmName("nnkkxasfboyxcteh")
    public suspend fun environmentSettings(vararg values: EnvironmentSettingArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.environmentSettings = mapped
    }

    /**
     * @param value The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit. Default is 0.
     */
    @JvmName("tujfflnjlafxcfak")
    public suspend fun maxTaskRetryCount(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maxTaskRetryCount = mapped
    }

    /**
     * @param value
     */
    @JvmName("gfawrhaxtdpqdtjv")
    public suspend fun resourceFiles(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceFiles = mapped
    }

    /**
     * @param argument
     */
    @JvmName("cikvvpmybtmhxyra")
    public suspend fun resourceFiles(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ResourceFileArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.resourceFiles = mapped
    }

    /**
     * @param argument
     */
    @JvmName("mhkgynlyijeifngv")
    public suspend fun resourceFiles(vararg argument: suspend ResourceFileArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            ResourceFileArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.resourceFiles = mapped
    }

    /**
     * @param argument
     */
    @JvmName("adfedcqioeitvqjm")
    public suspend fun resourceFiles(argument: suspend ResourceFileArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(ResourceFileArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.resourceFiles = mapped
    }

    /**
     * @param values
     */
    @JvmName("nqulohtlpkbxkcsa")
    public suspend fun resourceFiles(vararg values: ResourceFileArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.resourceFiles = mapped
    }

    /**
     * @param value If omitted, the task runs as a non-administrative user unique to the task.
     */
    @JvmName("linisywkvkmjtrmb")
    public suspend fun userIdentity(`value`: UserIdentityArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.userIdentity = mapped
    }

    /**
     * @param argument If omitted, the task runs as a non-administrative user unique to the task.
     */
    @JvmName("rbmxligpxyonyypo")
    public suspend fun userIdentity(argument: suspend UserIdentityArgsBuilder.() -> Unit) {
        val toBeMapped = UserIdentityArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.userIdentity = mapped
    }

    /**
     * @param value If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true.
     */
    @JvmName("owmrfebexnaaiurf")
    public suspend fun waitForSuccess(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.waitForSuccess = mapped
    }

    internal fun build(): StartTaskArgs = StartTaskArgs(
        commandLine = commandLine,
        containerSettings = containerSettings,
        environmentSettings = environmentSettings,
        maxTaskRetryCount = maxTaskRetryCount,
        resourceFiles = resourceFiles,
        userIdentity = userIdentity,
        waitForSuccess = waitForSuccess,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy