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

com.pulumi.azure.batch.kotlin.JobArgs.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: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.batch.kotlin

import com.pulumi.azure.batch.JobArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Batch Job.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-rg",
 *     location: "west europe",
 * });
 * const exampleAccount = new azure.batch.Account("example", {
 *     name: "exampleaccount",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const examplePool = new azure.batch.Pool("example", {
 *     name: "examplepool",
 *     resourceGroupName: example.name,
 *     accountName: exampleAccount.name,
 *     nodeAgentSkuId: "batch.node.ubuntu 16.04",
 *     vmSize: "Standard_A1",
 *     fixedScale: {
 *         targetDedicatedNodes: 1,
 *     },
 *     storageImageReference: {
 *         publisher: "Canonical",
 *         offer: "0001-com-ubuntu-server-jammy",
 *         sku: "22_04-lts",
 *         version: "latest",
 *     },
 * });
 * const exampleJob = new azure.batch.Job("example", {
 *     name: "examplejob",
 *     batchPoolId: examplePool.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-rg",
 *     location="west europe")
 * example_account = azure.batch.Account("example",
 *     name="exampleaccount",
 *     resource_group_name=example.name,
 *     location=example.location)
 * example_pool = azure.batch.Pool("example",
 *     name="examplepool",
 *     resource_group_name=example.name,
 *     account_name=example_account.name,
 *     node_agent_sku_id="batch.node.ubuntu 16.04",
 *     vm_size="Standard_A1",
 *     fixed_scale=azure.batch.PoolFixedScaleArgs(
 *         target_dedicated_nodes=1,
 *     ),
 *     storage_image_reference=azure.batch.PoolStorageImageReferenceArgs(
 *         publisher="Canonical",
 *         offer="0001-com-ubuntu-server-jammy",
 *         sku="22_04-lts",
 *         version="latest",
 *     ))
 * example_job = azure.batch.Job("example",
 *     name="examplejob",
 *     batch_pool_id=example_pool.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-rg",
 *         Location = "west europe",
 *     });
 *     var exampleAccount = new Azure.Batch.Account("example", new()
 *     {
 *         Name = "exampleaccount",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var examplePool = new Azure.Batch.Pool("example", new()
 *     {
 *         Name = "examplepool",
 *         ResourceGroupName = example.Name,
 *         AccountName = exampleAccount.Name,
 *         NodeAgentSkuId = "batch.node.ubuntu 16.04",
 *         VmSize = "Standard_A1",
 *         FixedScale = new Azure.Batch.Inputs.PoolFixedScaleArgs
 *         {
 *             TargetDedicatedNodes = 1,
 *         },
 *         StorageImageReference = new Azure.Batch.Inputs.PoolStorageImageReferenceArgs
 *         {
 *             Publisher = "Canonical",
 *             Offer = "0001-com-ubuntu-server-jammy",
 *             Sku = "22_04-lts",
 *             Version = "latest",
 *         },
 *     });
 *     var exampleJob = new Azure.Batch.Job("example", new()
 *     {
 *         Name = "examplejob",
 *         BatchPoolId = examplePool.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/batch"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-rg"),
 * 			Location: pulumi.String("west europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := batch.NewAccount(ctx, "example", &batch.AccountArgs{
 * 			Name:              pulumi.String("exampleaccount"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePool, err := batch.NewPool(ctx, "example", &batch.PoolArgs{
 * 			Name:              pulumi.String("examplepool"),
 * 			ResourceGroupName: example.Name,
 * 			AccountName:       exampleAccount.Name,
 * 			NodeAgentSkuId:    pulumi.String("batch.node.ubuntu 16.04"),
 * 			VmSize:            pulumi.String("Standard_A1"),
 * 			FixedScale: &batch.PoolFixedScaleArgs{
 * 				TargetDedicatedNodes: pulumi.Int(1),
 * 			},
 * 			StorageImageReference: &batch.PoolStorageImageReferenceArgs{
 * 				Publisher: pulumi.String("Canonical"),
 * 				Offer:     pulumi.String("0001-com-ubuntu-server-jammy"),
 * 				Sku:       pulumi.String("22_04-lts"),
 * 				Version:   pulumi.String("latest"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = batch.NewJob(ctx, "example", &batch.JobArgs{
 * 			Name:        pulumi.String("examplejob"),
 * 			BatchPoolId: examplePool.ID(),
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.batch.Account;
 * import com.pulumi.azure.batch.AccountArgs;
 * import com.pulumi.azure.batch.Pool;
 * import com.pulumi.azure.batch.PoolArgs;
 * import com.pulumi.azure.batch.inputs.PoolFixedScaleArgs;
 * import com.pulumi.azure.batch.inputs.PoolStorageImageReferenceArgs;
 * import com.pulumi.azure.batch.Job;
 * import com.pulumi.azure.batch.JobArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-rg")
 *             .location("west europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("exampleaccount")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         var examplePool = new Pool("examplePool", PoolArgs.builder()
 *             .name("examplepool")
 *             .resourceGroupName(example.name())
 *             .accountName(exampleAccount.name())
 *             .nodeAgentSkuId("batch.node.ubuntu 16.04")
 *             .vmSize("Standard_A1")
 *             .fixedScale(PoolFixedScaleArgs.builder()
 *                 .targetDedicatedNodes(1)
 *                 .build())
 *             .storageImageReference(PoolStorageImageReferenceArgs.builder()
 *                 .publisher("Canonical")
 *                 .offer("0001-com-ubuntu-server-jammy")
 *                 .sku("22_04-lts")
 *                 .version("latest")
 *                 .build())
 *             .build());
 *         var exampleJob = new Job("exampleJob", JobArgs.builder()
 *             .name("examplejob")
 *             .batchPoolId(examplePool.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-rg
 *       location: west europe
 *   exampleAccount:
 *     type: azure:batch:Account
 *     name: example
 *     properties:
 *       name: exampleaccount
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   examplePool:
 *     type: azure:batch:Pool
 *     name: example
 *     properties:
 *       name: examplepool
 *       resourceGroupName: ${example.name}
 *       accountName: ${exampleAccount.name}
 *       nodeAgentSkuId: batch.node.ubuntu 16.04
 *       vmSize: Standard_A1
 *       fixedScale:
 *         targetDedicatedNodes: 1
 *       storageImageReference:
 *         publisher: Canonical
 *         offer: 0001-com-ubuntu-server-jammy
 *         sku: 22_04-lts
 *         version: latest
 *   exampleJob:
 *     type: azure:batch:Job
 *     name: example
 *     properties:
 *       name: examplejob
 *       batchPoolId: ${examplePool.id}
 * ```
 * 
 * ## Import
 * Batch Jobs can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:batch/job:Job example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1/jobs/job1
 * ```
 * @property batchPoolId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
 * @property commonEnvironmentProperties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
 * @property displayName The display name of this Batch Job. Changing this forces a new Batch Job to be created.
 * @property name The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
 * @property priority The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to `0`.
 * @property taskRetryMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to `0`, the Batch service does not retry Tasks. If this is set to `-1`, the Batch service retries Batch Tasks without limit.
 */
public data class JobArgs(
    public val batchPoolId: Output? = null,
    public val commonEnvironmentProperties: Output>? = null,
    public val displayName: Output? = null,
    public val name: Output? = null,
    public val priority: Output? = null,
    public val taskRetryMaximum: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.batch.JobArgs = com.pulumi.azure.batch.JobArgs.builder()
        .batchPoolId(batchPoolId?.applyValue({ args0 -> args0 }))
        .commonEnvironmentProperties(
            commonEnvironmentProperties?.applyValue({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }),
        )
        .displayName(displayName?.applyValue({ args0 -> args0 }))
        .name(name?.applyValue({ args0 -> args0 }))
        .priority(priority?.applyValue({ args0 -> args0 }))
        .taskRetryMaximum(taskRetryMaximum?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [JobArgs].
 */
@PulumiTagMarker
public class JobArgsBuilder internal constructor() {
    private var batchPoolId: Output? = null

    private var commonEnvironmentProperties: Output>? = null

    private var displayName: Output? = null

    private var name: Output? = null

    private var priority: Output? = null

    private var taskRetryMaximum: Output? = null

    /**
     * @param value The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
     */
    @JvmName("giweaxbsqyyblqee")
    public suspend fun batchPoolId(`value`: Output) {
        this.batchPoolId = value
    }

    /**
     * @param value Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
     */
    @JvmName("xyqqjqjianvwcvkj")
    public suspend fun commonEnvironmentProperties(`value`: Output>) {
        this.commonEnvironmentProperties = value
    }

    /**
     * @param value The display name of this Batch Job. Changing this forces a new Batch Job to be created.
     */
    @JvmName("iggbswrsnxrgsipm")
    public suspend fun displayName(`value`: Output) {
        this.displayName = value
    }

    /**
     * @param value The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
     */
    @JvmName("mholdtgrdutvvvvh")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to `0`.
     */
    @JvmName("jxtdhxbsehcyvnrv")
    public suspend fun priority(`value`: Output) {
        this.priority = value
    }

    /**
     * @param value The number of retries to each Batch Task belongs to this Batch Job. If this is set to `0`, the Batch service does not retry Tasks. If this is set to `-1`, the Batch service retries Batch Tasks without limit.
     */
    @JvmName("adffgvsfxvlrxrbc")
    public suspend fun taskRetryMaximum(`value`: Output) {
        this.taskRetryMaximum = value
    }

    /**
     * @param value The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
     */
    @JvmName("foturfijenyhqaxv")
    public suspend fun batchPoolId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.batchPoolId = mapped
    }

    /**
     * @param value Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
     */
    @JvmName("knjvexfyvehybjaa")
    public suspend fun commonEnvironmentProperties(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.commonEnvironmentProperties = mapped
    }

    /**
     * @param values Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
     */
    @JvmName("tjsvjpriuogsqyqf")
    public fun commonEnvironmentProperties(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.commonEnvironmentProperties = mapped
    }

    /**
     * @param value The display name of this Batch Job. Changing this forces a new Batch Job to be created.
     */
    @JvmName("knvloffypupbqhvs")
    public suspend fun displayName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.displayName = mapped
    }

    /**
     * @param value The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
     */
    @JvmName("gmacynifqvuccrob")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to `0`.
     */
    @JvmName("acmnytuhlppdycen")
    public suspend fun priority(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.priority = mapped
    }

    /**
     * @param value The number of retries to each Batch Task belongs to this Batch Job. If this is set to `0`, the Batch service does not retry Tasks. If this is set to `-1`, the Batch service retries Batch Tasks without limit.
     */
    @JvmName("pbxasmfxrrninjhb")
    public suspend fun taskRetryMaximum(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.taskRetryMaximum = mapped
    }

    internal fun build(): JobArgs = JobArgs(
        batchPoolId = batchPoolId,
        commonEnvironmentProperties = commonEnvironmentProperties,
        displayName = displayName,
        name = name,
        priority = priority,
        taskRetryMaximum = taskRetryMaximum,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy