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

com.pulumi.azure.batch.kotlin.Pool.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.batch.kotlin

import com.pulumi.azure.batch.kotlin.outputs.PoolAutoScale
import com.pulumi.azure.batch.kotlin.outputs.PoolCertificate
import com.pulumi.azure.batch.kotlin.outputs.PoolContainerConfiguration
import com.pulumi.azure.batch.kotlin.outputs.PoolDataDisk
import com.pulumi.azure.batch.kotlin.outputs.PoolDiskEncryption
import com.pulumi.azure.batch.kotlin.outputs.PoolExtension
import com.pulumi.azure.batch.kotlin.outputs.PoolFixedScale
import com.pulumi.azure.batch.kotlin.outputs.PoolIdentity
import com.pulumi.azure.batch.kotlin.outputs.PoolMount
import com.pulumi.azure.batch.kotlin.outputs.PoolNetworkConfiguration
import com.pulumi.azure.batch.kotlin.outputs.PoolNodePlacement
import com.pulumi.azure.batch.kotlin.outputs.PoolStartTask
import com.pulumi.azure.batch.kotlin.outputs.PoolStorageImageReference
import com.pulumi.azure.batch.kotlin.outputs.PoolTaskSchedulingPolicy
import com.pulumi.azure.batch.kotlin.outputs.PoolUserAccount
import com.pulumi.azure.batch.kotlin.outputs.PoolWindow
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.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.batch.kotlin.outputs.PoolAutoScale.Companion.toKotlin as poolAutoScaleToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolCertificate.Companion.toKotlin as poolCertificateToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolContainerConfiguration.Companion.toKotlin as poolContainerConfigurationToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolDataDisk.Companion.toKotlin as poolDataDiskToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolDiskEncryption.Companion.toKotlin as poolDiskEncryptionToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolExtension.Companion.toKotlin as poolExtensionToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolFixedScale.Companion.toKotlin as poolFixedScaleToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolIdentity.Companion.toKotlin as poolIdentityToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolMount.Companion.toKotlin as poolMountToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolNetworkConfiguration.Companion.toKotlin as poolNetworkConfigurationToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolNodePlacement.Companion.toKotlin as poolNodePlacementToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolStartTask.Companion.toKotlin as poolStartTaskToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolStorageImageReference.Companion.toKotlin as poolStorageImageReferenceToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolTaskSchedulingPolicy.Companion.toKotlin as poolTaskSchedulingPolicyToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolUserAccount.Companion.toKotlin as poolUserAccountToKotlin
import com.pulumi.azure.batch.kotlin.outputs.PoolWindow.Companion.toKotlin as poolWindowToKotlin

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

    public var args: PoolArgs = PoolArgs()

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

/**
 * Manages an Azure Batch pool.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "testaccbatch",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "testaccsa",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleAccount2 = new azure.batch.Account("example", {
 *     name: "testaccbatch",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     poolAllocationMode: "BatchService",
 *     storageAccountId: exampleAccount.id,
 *     storageAccountAuthenticationMode: "StorageKeys",
 *     tags: {
 *         env: "test",
 *     },
 * });
 * const exampleCertificate = new azure.batch.Certificate("example", {
 *     resourceGroupName: example.name,
 *     accountName: exampleAccount2.name,
 *     certificate: std.filebase64({
 *         input: "certificate.cer",
 *     }).then(invoke => invoke.result),
 *     format: "Cer",
 *     thumbprint: "312d31a79fa0cef49c00f769afc2b73e9f4edf34",
 *     thumbprintAlgorithm: "SHA1",
 * });
 * const examplePool = new azure.batch.Pool("example", {
 *     name: "testaccpool",
 *     resourceGroupName: example.name,
 *     accountName: exampleAccount2.name,
 *     displayName: "Test Acc Pool Auto",
 *     vmSize: "Standard_A1",
 *     nodeAgentSkuId: "batch.node.ubuntu 20.04",
 *     autoScale: {
 *         evaluationInterval: "PT15M",
 *         formula: `      startingNumberOfVMs = 1;
 *       maxNumberofVMs = 25;
 *       pendingTaskSamplePercent = PendingTasks.GetSamplePercent(180 * TimeInterval_Second);
 *       pendingTaskSamples = pendingTaskSamplePercent < 70 ? startingNumberOfVMs : avg(PendingTasks.GetSample(180 *   TimeInterval_Second));
 *       TargetDedicatedNodes=min(maxNumberofVMs, pendingTaskSamples);
 * `,
 *     },
 *     storageImageReference: {
 *         publisher: "microsoft-azure-batch",
 *         offer: "ubuntu-server-container",
 *         sku: "20-04-lts",
 *         version: "latest",
 *     },
 *     containerConfiguration: {
 *         type: "DockerCompatible",
 *         containerRegistries: [{
 *             registryServer: "docker.io",
 *             userName: "login",
 *             password: "apassword",
 *         }],
 *     },
 *     startTask: {
 *         commandLine: "echo 'Hello World from $env'",
 *         taskRetryMaximum: 1,
 *         waitForSuccess: true,
 *         commonEnvironmentProperties: {
 *             env: "TEST",
 *         },
 *         userIdentity: {
 *             autoUser: {
 *                 elevationLevel: "NonAdmin",
 *                 scope: "Task",
 *             },
 *         },
 *     },
 *     certificates: [{
 *         id: exampleCertificate.id,
 *         storeLocation: "CurrentUser",
 *         visibilities: ["StartTask"],
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_std as std
 * example = azure.core.ResourceGroup("example",
 *     name="testaccbatch",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="testaccsa",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_account2 = azure.batch.Account("example",
 *     name="testaccbatch",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     pool_allocation_mode="BatchService",
 *     storage_account_id=example_account.id,
 *     storage_account_authentication_mode="StorageKeys",
 *     tags={
 *         "env": "test",
 *     })
 * example_certificate = azure.batch.Certificate("example",
 *     resource_group_name=example.name,
 *     account_name=example_account2.name,
 *     certificate=std.filebase64(input="certificate.cer").result,
 *     format="Cer",
 *     thumbprint="312d31a79fa0cef49c00f769afc2b73e9f4edf34",
 *     thumbprint_algorithm="SHA1")
 * example_pool = azure.batch.Pool("example",
 *     name="testaccpool",
 *     resource_group_name=example.name,
 *     account_name=example_account2.name,
 *     display_name="Test Acc Pool Auto",
 *     vm_size="Standard_A1",
 *     node_agent_sku_id="batch.node.ubuntu 20.04",
 *     auto_scale={
 *         "evaluation_interval": "PT15M",
 *         "formula": """      startingNumberOfVMs = 1;
 *       maxNumberofVMs = 25;
 *       pendingTaskSamplePercent = $PendingTasks.GetSamplePercent(180 * TimeInterval_Second);
 *       pendingTaskSamples = pendingTaskSamplePercent < 70 ? startingNumberOfVMs : avg($PendingTasks.GetSample(180 *   TimeInterval_Second));
 *       $TargetDedicatedNodes=min(maxNumberofVMs, pendingTaskSamples);
 * """,
 *     },
 *     storage_image_reference={
 *         "publisher": "microsoft-azure-batch",
 *         "offer": "ubuntu-server-container",
 *         "sku": "20-04-lts",
 *         "version": "latest",
 *     },
 *     container_configuration={
 *         "type": "DockerCompatible",
 *         "container_registries": [{
 *             "registry_server": "docker.io",
 *             "user_name": "login",
 *             "password": "apassword",
 *         }],
 *     },
 *     start_task={
 *         "command_line": "echo 'Hello World from $env'",
 *         "task_retry_maximum": 1,
 *         "wait_for_success": True,
 *         "common_environment_properties": {
 *             "env": "TEST",
 *         },
 *         "user_identity": {
 *             "auto_user": {
 *                 "elevation_level": "NonAdmin",
 *                 "scope": "Task",
 *             },
 *         },
 *     },
 *     certificates=[{
 *         "id": example_certificate.id,
 *         "store_location": "CurrentUser",
 *         "visibilities": ["StartTask"],
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "testaccbatch",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "testaccsa",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleAccount2 = new Azure.Batch.Account("example", new()
 *     {
 *         Name = "testaccbatch",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         PoolAllocationMode = "BatchService",
 *         StorageAccountId = exampleAccount.Id,
 *         StorageAccountAuthenticationMode = "StorageKeys",
 *         Tags =
 *         {
 *             { "env", "test" },
 *         },
 *     });
 *     var exampleCertificate = new Azure.Batch.Certificate("example", new()
 *     {
 *         ResourceGroupName = example.Name,
 *         AccountName = exampleAccount2.Name,
 *         BatchCertificate = Std.Filebase64.Invoke(new()
 *         {
 *             Input = "certificate.cer",
 *         }).Apply(invoke => invoke.Result),
 *         Format = "Cer",
 *         Thumbprint = "312d31a79fa0cef49c00f769afc2b73e9f4edf34",
 *         ThumbprintAlgorithm = "SHA1",
 *     });
 *     var examplePool = new Azure.Batch.Pool("example", new()
 *     {
 *         Name = "testaccpool",
 *         ResourceGroupName = example.Name,
 *         AccountName = exampleAccount2.Name,
 *         DisplayName = "Test Acc Pool Auto",
 *         VmSize = "Standard_A1",
 *         NodeAgentSkuId = "batch.node.ubuntu 20.04",
 *         AutoScale = new Azure.Batch.Inputs.PoolAutoScaleArgs
 *         {
 *             EvaluationInterval = "PT15M",
 *             Formula = @"      startingNumberOfVMs = 1;
 *       maxNumberofVMs = 25;
 *       pendingTaskSamplePercent = $PendingTasks.GetSamplePercent(180 * TimeInterval_Second);
 *       pendingTaskSamples = pendingTaskSamplePercent < 70 ? startingNumberOfVMs : avg($PendingTasks.GetSample(180 *   TimeInterval_Second));
 *       $TargetDedicatedNodes=min(maxNumberofVMs, pendingTaskSamples);
 * ",
 *         },
 *         StorageImageReference = new Azure.Batch.Inputs.PoolStorageImageReferenceArgs
 *         {
 *             Publisher = "microsoft-azure-batch",
 *             Offer = "ubuntu-server-container",
 *             Sku = "20-04-lts",
 *             Version = "latest",
 *         },
 *         ContainerConfiguration = new Azure.Batch.Inputs.PoolContainerConfigurationArgs
 *         {
 *             Type = "DockerCompatible",
 *             ContainerRegistries = new[]
 *             {
 *                 new Azure.Batch.Inputs.PoolContainerConfigurationContainerRegistryArgs
 *                 {
 *                     RegistryServer = "docker.io",
 *                     UserName = "login",
 *                     Password = "apassword",
 *                 },
 *             },
 *         },
 *         StartTask = new Azure.Batch.Inputs.PoolStartTaskArgs
 *         {
 *             CommandLine = "echo 'Hello World from $env'",
 *             TaskRetryMaximum = 1,
 *             WaitForSuccess = true,
 *             CommonEnvironmentProperties =
 *             {
 *                 { "env", "TEST" },
 *             },
 *             UserIdentity = new Azure.Batch.Inputs.PoolStartTaskUserIdentityArgs
 *             {
 *                 AutoUser = new Azure.Batch.Inputs.PoolStartTaskUserIdentityAutoUserArgs
 *                 {
 *                     ElevationLevel = "NonAdmin",
 *                     Scope = "Task",
 *                 },
 *             },
 *         },
 *         Certificates = new[]
 *         {
 *             new Azure.Batch.Inputs.PoolCertificateArgs
 *             {
 *                 Id = exampleCertificate.Id,
 *                 StoreLocation = "CurrentUser",
 *                 Visibilities = new[]
 *                 {
 *                     "StartTask",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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-azure/sdk/v5/go/azure/storage"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"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("testaccbatch"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("testaccsa"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount2, err := batch.NewAccount(ctx, "example", &batch.AccountArgs{
 * 			Name:                             pulumi.String("testaccbatch"),
 * 			ResourceGroupName:                example.Name,
 * 			Location:                         example.Location,
 * 			PoolAllocationMode:               pulumi.String("BatchService"),
 * 			StorageAccountId:                 exampleAccount.ID(),
 * 			StorageAccountAuthenticationMode: pulumi.String("StorageKeys"),
 * 			Tags: pulumi.StringMap{
 * 				"env": pulumi.String("test"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
 * 			Input: "certificate.cer",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleCertificate, err := batch.NewCertificate(ctx, "example", &batch.CertificateArgs{
 * 			ResourceGroupName:   example.Name,
 * 			AccountName:         exampleAccount2.Name,
 * 			Certificate:         pulumi.String(invokeFilebase64.Result),
 * 			Format:              pulumi.String("Cer"),
 * 			Thumbprint:          pulumi.String("312d31a79fa0cef49c00f769afc2b73e9f4edf34"),
 * 			ThumbprintAlgorithm: pulumi.String("SHA1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = batch.NewPool(ctx, "example", &batch.PoolArgs{
 * 			Name:              pulumi.String("testaccpool"),
 * 			ResourceGroupName: example.Name,
 * 			AccountName:       exampleAccount2.Name,
 * 			DisplayName:       pulumi.String("Test Acc Pool Auto"),
 * 			VmSize:            pulumi.String("Standard_A1"),
 * 			NodeAgentSkuId:    pulumi.String("batch.node.ubuntu 20.04"),
 * 			AutoScale: &batch.PoolAutoScaleArgs{
 * 				EvaluationInterval: pulumi.String("PT15M"),
 * 				Formula: pulumi.String(`      startingNumberOfVMs = 1;
 *       maxNumberofVMs = 25;
 *       pendingTaskSamplePercent = $PendingTasks.GetSamplePercent(180 * TimeInterval_Second);
 *       pendingTaskSamples = pendingTaskSamplePercent < 70 ? startingNumberOfVMs : avg($PendingTasks.GetSample(180 *   TimeInterval_Second));
 *       $TargetDedicatedNodes=min(maxNumberofVMs, pendingTaskSamples);
 * `),
 * 			},
 * 			StorageImageReference: &batch.PoolStorageImageReferenceArgs{
 * 				Publisher: pulumi.String("microsoft-azure-batch"),
 * 				Offer:     pulumi.String("ubuntu-server-container"),
 * 				Sku:       pulumi.String("20-04-lts"),
 * 				Version:   pulumi.String("latest"),
 * 			},
 * 			ContainerConfiguration: &batch.PoolContainerConfigurationArgs{
 * 				Type: pulumi.String("DockerCompatible"),
 * 				ContainerRegistries: batch.PoolContainerConfigurationContainerRegistryArray{
 * 					&batch.PoolContainerConfigurationContainerRegistryArgs{
 * 						RegistryServer: pulumi.String("docker.io"),
 * 						UserName:       pulumi.String("login"),
 * 						Password:       pulumi.String("apassword"),
 * 					},
 * 				},
 * 			},
 * 			StartTask: &batch.PoolStartTaskArgs{
 * 				CommandLine:      pulumi.String("echo 'Hello World from $env'"),
 * 				TaskRetryMaximum: pulumi.Int(1),
 * 				WaitForSuccess:   pulumi.Bool(true),
 * 				CommonEnvironmentProperties: pulumi.StringMap{
 * 					"env": pulumi.String("TEST"),
 * 				},
 * 				UserIdentity: &batch.PoolStartTaskUserIdentityArgs{
 * 					AutoUser: &batch.PoolStartTaskUserIdentityAutoUserArgs{
 * 						ElevationLevel: pulumi.String("NonAdmin"),
 * 						Scope:          pulumi.String("Task"),
 * 					},
 * 				},
 * 			},
 * 			Certificates: batch.PoolCertificateArray{
 * 				&batch.PoolCertificateArgs{
 * 					Id:            exampleCertificate.ID(),
 * 					StoreLocation: pulumi.String("CurrentUser"),
 * 					Visibilities: pulumi.StringArray{
 * 						pulumi.String("StartTask"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.batch.Account;
 * import com.pulumi.azure.batch.AccountArgs;
 * import com.pulumi.azure.batch.Certificate;
 * import com.pulumi.azure.batch.CertificateArgs;
 * import com.pulumi.azure.batch.Pool;
 * import com.pulumi.azure.batch.PoolArgs;
 * import com.pulumi.azure.batch.inputs.PoolAutoScaleArgs;
 * import com.pulumi.azure.batch.inputs.PoolStorageImageReferenceArgs;
 * import com.pulumi.azure.batch.inputs.PoolContainerConfigurationArgs;
 * import com.pulumi.azure.batch.inputs.PoolStartTaskArgs;
 * import com.pulumi.azure.batch.inputs.PoolStartTaskUserIdentityArgs;
 * import com.pulumi.azure.batch.inputs.PoolStartTaskUserIdentityAutoUserArgs;
 * import com.pulumi.azure.batch.inputs.PoolCertificateArgs;
 * 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("testaccbatch")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("testaccsa")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleAccount2 = new Account("exampleAccount2", AccountArgs.builder()
 *             .name("testaccbatch")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .poolAllocationMode("BatchService")
 *             .storageAccountId(exampleAccount.id())
 *             .storageAccountAuthenticationMode("StorageKeys")
 *             .tags(Map.of("env", "test"))
 *             .build());
 *         var exampleCertificate = new Certificate("exampleCertificate", CertificateArgs.builder()
 *             .resourceGroupName(example.name())
 *             .accountName(exampleAccount2.name())
 *             .certificate(StdFunctions.filebase64(Filebase64Args.builder()
 *                 .input("certificate.cer")
 *                 .build()).result())
 *             .format("Cer")
 *             .thumbprint("312d31a79fa0cef49c00f769afc2b73e9f4edf34")
 *             .thumbprintAlgorithm("SHA1")
 *             .build());
 *         var examplePool = new Pool("examplePool", PoolArgs.builder()
 *             .name("testaccpool")
 *             .resourceGroupName(example.name())
 *             .accountName(exampleAccount2.name())
 *             .displayName("Test Acc Pool Auto")
 *             .vmSize("Standard_A1")
 *             .nodeAgentSkuId("batch.node.ubuntu 20.04")
 *             .autoScale(PoolAutoScaleArgs.builder()
 *                 .evaluationInterval("PT15M")
 *                 .formula("""
 *       startingNumberOfVMs = 1;
 *       maxNumberofVMs = 25;
 *       pendingTaskSamplePercent = $PendingTasks.GetSamplePercent(180 * TimeInterval_Second);
 *       pendingTaskSamples = pendingTaskSamplePercent < 70 ? startingNumberOfVMs : avg($PendingTasks.GetSample(180 *   TimeInterval_Second));
 *       $TargetDedicatedNodes=min(maxNumberofVMs, pendingTaskSamples);
 *                 """)
 *                 .build())
 *             .storageImageReference(PoolStorageImageReferenceArgs.builder()
 *                 .publisher("microsoft-azure-batch")
 *                 .offer("ubuntu-server-container")
 *                 .sku("20-04-lts")
 *                 .version("latest")
 *                 .build())
 *             .containerConfiguration(PoolContainerConfigurationArgs.builder()
 *                 .type("DockerCompatible")
 *                 .containerRegistries(PoolContainerConfigurationContainerRegistryArgs.builder()
 *                     .registryServer("docker.io")
 *                     .userName("login")
 *                     .password("apassword")
 *                     .build())
 *                 .build())
 *             .startTask(PoolStartTaskArgs.builder()
 *                 .commandLine("echo 'Hello World from $env'")
 *                 .taskRetryMaximum(1)
 *                 .waitForSuccess(true)
 *                 .commonEnvironmentProperties(Map.of("env", "TEST"))
 *                 .userIdentity(PoolStartTaskUserIdentityArgs.builder()
 *                     .autoUser(PoolStartTaskUserIdentityAutoUserArgs.builder()
 *                         .elevationLevel("NonAdmin")
 *                         .scope("Task")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .certificates(PoolCertificateArgs.builder()
 *                 .id(exampleCertificate.id())
 *                 .storeLocation("CurrentUser")
 *                 .visibilities("StartTask")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: testaccbatch
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: testaccsa
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleAccount2:
 *     type: azure:batch:Account
 *     name: example
 *     properties:
 *       name: testaccbatch
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       poolAllocationMode: BatchService
 *       storageAccountId: ${exampleAccount.id}
 *       storageAccountAuthenticationMode: StorageKeys
 *       tags:
 *         env: test
 *   exampleCertificate:
 *     type: azure:batch:Certificate
 *     name: example
 *     properties:
 *       resourceGroupName: ${example.name}
 *       accountName: ${exampleAccount2.name}
 *       certificate:
 *         fn::invoke:
 *           Function: std:filebase64
 *           Arguments:
 *             input: certificate.cer
 *           Return: result
 *       format: Cer
 *       thumbprint: 312d31a79fa0cef49c00f769afc2b73e9f4edf34
 *       thumbprintAlgorithm: SHA1
 *   examplePool:
 *     type: azure:batch:Pool
 *     name: example
 *     properties:
 *       name: testaccpool
 *       resourceGroupName: ${example.name}
 *       accountName: ${exampleAccount2.name}
 *       displayName: Test Acc Pool Auto
 *       vmSize: Standard_A1
 *       nodeAgentSkuId: batch.node.ubuntu 20.04
 *       autoScale:
 *         evaluationInterval: PT15M
 *         formula: |2
 *                 startingNumberOfVMs = 1;
 *                 maxNumberofVMs = 25;
 *                 pendingTaskSamplePercent = $PendingTasks.GetSamplePercent(180 * TimeInterval_Second);
 *                 pendingTaskSamples = pendingTaskSamplePercent < 70 ? startingNumberOfVMs : avg($PendingTasks.GetSample(180 *   TimeInterval_Second));
 *                 $TargetDedicatedNodes=min(maxNumberofVMs, pendingTaskSamples);
 *       storageImageReference:
 *         publisher: microsoft-azure-batch
 *         offer: ubuntu-server-container
 *         sku: 20-04-lts
 *         version: latest
 *       containerConfiguration:
 *         type: DockerCompatible
 *         containerRegistries:
 *           - registryServer: docker.io
 *             userName: login
 *             password: apassword
 *       startTask:
 *         commandLine: echo 'Hello World from $env'
 *         taskRetryMaximum: 1
 *         waitForSuccess: true
 *         commonEnvironmentProperties:
 *           env: TEST
 *         userIdentity:
 *           autoUser:
 *             elevationLevel: NonAdmin
 *             scope: Task
 *       certificates:
 *         - id: ${exampleCertificate.id}
 *           storeLocation: CurrentUser
 *           visibilities:
 *             - StartTask
 * ```
 * 
 * ## Import
 * Batch Pools can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:batch/pool:Pool example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup1/providers/Microsoft.Batch/batchAccounts/myBatchAccount1/pools/myBatchPool1
 * ```
 */
public class Pool internal constructor(
    override val javaResource: com.pulumi.azure.batch.Pool,
) : KotlinCustomResource(javaResource, PoolMapper) {
    /**
     * Specifies the name of the Batch account in which the pool will be created. Changing this forces a new resource to be created.
     */
    public val accountName: Output
        get() = javaResource.accountName().applyValue({ args0 -> args0 })

    /**
     * A `auto_scale` block that describes the scale settings when using auto scale as defined below.
     */
    public val autoScale: Output?
        get() = javaResource.autoScale().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    poolAutoScaleToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * One or more `certificate` blocks that describe the certificates to be installed on each compute node in the pool as defined below.
     */
    public val certificates: Output>?
        get() = javaResource.certificates().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> poolCertificateToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The container configuration used in the pool's VMs. One `container_configuration` block as defined below.
     */
    public val containerConfiguration: Output?
        get() = javaResource.containerConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> poolContainerConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A `data_disks` block describes the data disk settings as defined below.
     */
    public val dataDisks: Output>?
        get() = javaResource.dataDisks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> poolDataDiskToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * A `disk_encryption` block, as defined below, describes the disk encryption configuration applied on compute nodes in the pool. Disk encryption configuration is not supported on Linux pool created with Virtual Machine Image or Shared Image Gallery Image.
     */
    public val diskEncryptions: Output>?
        get() = javaResource.diskEncryptions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        poolDiskEncryptionToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Specifies the display name of the Batch pool. Changing this forces a new resource to be created.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An `extensions` block as defined below.
     */
    public val extensions: Output>?
        get() = javaResource.extensions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> poolExtensionToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * A `fixed_scale` block that describes the scale settings when using fixed scale as defined below.
     */
    public val fixedScale: Output?
        get() = javaResource.fixedScale().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    poolFixedScaleToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    poolIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Whether the pool permits direct communication between nodes. This imposes restrictions on which nodes can be assigned to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. Values allowed are `Disabled` and `Enabled`. Defaults to `Enabled`.
     */
    public val interNodeCommunication: Output?
        get() = javaResource.interNodeCommunication().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The type of on-premises license to be used when deploying the operating system. This only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: "Windows_Server" - The on-premises license is for Windows Server. "Windows_Client" - The on-premises license is for Windows Client.
     */
    public val licenseType: Output?
        get() = javaResource.licenseType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the maximum number of tasks that can run concurrently on a single compute node in the pool. Defaults to `1`. Changing this forces a new resource to be created.
     */
    public val maxTasksPerNode: Output?
        get() = javaResource.maxTasksPerNode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A map of custom batch pool metadata.
     */
    public val metadata: Output>?
        get() = javaResource.metadata().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A `mount` block defined as below.
     */
    public val mounts: Output>?
        get() = javaResource.mounts().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> poolMountToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Specifies the name of the Batch pool. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A `network_configuration` block that describes the network configurations for the Batch pool as defined below. Changing this forces a new resource to be created.
     */
    public val networkConfiguration: Output?
        get() = javaResource.networkConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> poolNetworkConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Specifies the SKU of the node agents that will be created in the Batch pool. Changing this forces a new resource to be created.
     */
    public val nodeAgentSkuId: Output
        get() = javaResource.nodeAgentSkuId().applyValue({ args0 -> args0 })

    /**
     * A `node_placement` block that describes the placement policy for allocating nodes in the pool as defined below.
     */
    public val nodePlacements: Output>?
        get() = javaResource.nodePlacements().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        poolNodePlacementToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Specifies the ephemeral disk placement for operating system disk for all VMs in the pool. This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at  and Linux VMs at . The only possible value is `CacheDisk`.
     */
    public val osDiskPlacement: Output?
        get() = javaResource.osDiskPlacement().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the resource group in which to create the Batch pool. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A `start_task` block that describes the start task settings for the Batch pool as defined below.
     */
    public val startTask: Output?
        get() = javaResource.startTask().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    poolStartTaskToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Whether to stop if there is a pending resize operation on this pool.
     */
    public val stopPendingResizeOperation: Output?
        get() = javaResource.stopPendingResizeOperation().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `storage_image_reference` block for the virtual machines that will compose the Batch pool as defined below. Changing this forces a new resource to be created.
     */
    public val storageImageReference: Output
        get() = javaResource.storageImageReference().applyValue({ args0 ->
            args0.let({ args0 ->
                poolStorageImageReferenceToKotlin(args0)
            })
        })

    /**
     * The desired node communication mode for the pool. Possible values are `Classic`, `Default` and `Simplified`.
     */
    public val targetNodeCommunicationMode: Output?
        get() = javaResource.targetNodeCommunicationMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `task_scheduling_policy` block that describes how tasks are distributed across compute nodes in a pool as defined below. If not specified, the default is spread as defined below.
     */
    public val taskSchedulingPolicies: Output>
        get() = javaResource.taskSchedulingPolicies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> poolTaskSchedulingPolicyToKotlin(args0) })
            })
        })

    /**
     * A `user_accounts` block that describes the list of user accounts to be created on each node in the pool as defined below.
     */
    public val userAccounts: Output>?
        get() = javaResource.userAccounts().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> poolUserAccountToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Specifies the size of the VM created in the Batch pool. Changing this forces a new resource to be created.
     */
    public val vmSize: Output
        get() = javaResource.vmSize().applyValue({ args0 -> args0 })

    /**
     * A `windows` block that describes the Windows configuration in the pool as defined below.
     * > **NOTE:** For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable `AZ_BATCH_CERTIFICATES_DIR` is supplied to the task to query for this location. For certificates with visibility of `remoteUser`, a `certs` directory is created in the user's home directory (e.g., `/home/{user-name}/certs`) and certificates are placed in that directory.
     * > **Please Note:** `fixed_scale` and `auto_scale` blocks cannot be used both at the same time.
     */
    public val windows: Output>?
        get() = javaResource.windows().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> poolWindowToKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object PoolMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.batch.Pool::class == javaResource::class

    override fun map(javaResource: Resource): Pool = Pool(javaResource as com.pulumi.azure.batch.Pool)
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy