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

com.pulumi.azure.desktopvirtualization.kotlin.HostPool.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.desktopvirtualization.kotlin

import com.pulumi.azure.desktopvirtualization.kotlin.outputs.HostPoolScheduledAgentUpdates
import com.pulumi.azure.desktopvirtualization.kotlin.outputs.HostPoolScheduledAgentUpdates.Companion.toKotlin
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.Map

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

    public var args: HostPoolArgs = HostPoolArgs()

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

/**
 * Manages a Virtual Desktop Host Pool.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleHostPool = new azure.desktopvirtualization.HostPool("example", {
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     name: "pooleddepthfirst",
 *     friendlyName: "pooleddepthfirst",
 *     validateEnvironment: true,
 *     startVmOnConnect: true,
 *     customRdpProperties: "audiocapturemode:i:1;audiomode:i:0;",
 *     description: "Acceptance Test: A pooled host pool - pooleddepthfirst",
 *     type: "Pooled",
 *     maximumSessionsAllowed: 50,
 *     loadBalancerType: "DepthFirst",
 *     scheduledAgentUpdates: {
 *         enabled: true,
 *         schedules: [{
 *             dayOfWeek: "Saturday",
 *             hourOfDay: 2,
 *         }],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_host_pool = azure.desktopvirtualization.HostPool("example",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     name="pooleddepthfirst",
 *     friendly_name="pooleddepthfirst",
 *     validate_environment=True,
 *     start_vm_on_connect=True,
 *     custom_rdp_properties="audiocapturemode:i:1;audiomode:i:0;",
 *     description="Acceptance Test: A pooled host pool - pooleddepthfirst",
 *     type="Pooled",
 *     maximum_sessions_allowed=50,
 *     load_balancer_type="DepthFirst",
 *     scheduled_agent_updates=azure.desktopvirtualization.HostPoolScheduledAgentUpdatesArgs(
 *         enabled=True,
 *         schedules=[azure.desktopvirtualization.HostPoolScheduledAgentUpdatesScheduleArgs(
 *             day_of_week="Saturday",
 *             hour_of_day=2,
 *         )],
 *     ))
 * ```
 * ```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-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleHostPool = new Azure.DesktopVirtualization.HostPool("example", new()
 *     {
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Name = "pooleddepthfirst",
 *         FriendlyName = "pooleddepthfirst",
 *         ValidateEnvironment = true,
 *         StartVmOnConnect = true,
 *         CustomRdpProperties = "audiocapturemode:i:1;audiomode:i:0;",
 *         Description = "Acceptance Test: A pooled host pool - pooleddepthfirst",
 *         Type = "Pooled",
 *         MaximumSessionsAllowed = 50,
 *         LoadBalancerType = "DepthFirst",
 *         ScheduledAgentUpdates = new Azure.DesktopVirtualization.Inputs.HostPoolScheduledAgentUpdatesArgs
 *         {
 *             Enabled = true,
 *             Schedules = new[]
 *             {
 *                 new Azure.DesktopVirtualization.Inputs.HostPoolScheduledAgentUpdatesScheduleArgs
 *                 {
 *                     DayOfWeek = "Saturday",
 *                     HourOfDay = 2,
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/desktopvirtualization"
 * 	"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-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = desktopvirtualization.NewHostPool(ctx, "example", &desktopvirtualization.HostPoolArgs{
 * 			Location:               example.Location,
 * 			ResourceGroupName:      example.Name,
 * 			Name:                   pulumi.String("pooleddepthfirst"),
 * 			FriendlyName:           pulumi.String("pooleddepthfirst"),
 * 			ValidateEnvironment:    pulumi.Bool(true),
 * 			StartVmOnConnect:       pulumi.Bool(true),
 * 			CustomRdpProperties:    pulumi.String("audiocapturemode:i:1;audiomode:i:0;"),
 * 			Description:            pulumi.String("Acceptance Test: A pooled host pool - pooleddepthfirst"),
 * 			Type:                   pulumi.String("Pooled"),
 * 			MaximumSessionsAllowed: pulumi.Int(50),
 * 			LoadBalancerType:       pulumi.String("DepthFirst"),
 * 			ScheduledAgentUpdates: &desktopvirtualization.HostPoolScheduledAgentUpdatesArgs{
 * 				Enabled: pulumi.Bool(true),
 * 				Schedules: desktopvirtualization.HostPoolScheduledAgentUpdatesScheduleArray{
 * 					&desktopvirtualization.HostPoolScheduledAgentUpdatesScheduleArgs{
 * 						DayOfWeek: pulumi.String("Saturday"),
 * 						HourOfDay: pulumi.Int(2),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.desktopvirtualization.HostPool;
 * import com.pulumi.azure.desktopvirtualization.HostPoolArgs;
 * import com.pulumi.azure.desktopvirtualization.inputs.HostPoolScheduledAgentUpdatesArgs;
 * 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-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleHostPool = new HostPool("exampleHostPool", HostPoolArgs.builder()
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .name("pooleddepthfirst")
 *             .friendlyName("pooleddepthfirst")
 *             .validateEnvironment(true)
 *             .startVmOnConnect(true)
 *             .customRdpProperties("audiocapturemode:i:1;audiomode:i:0;")
 *             .description("Acceptance Test: A pooled host pool - pooleddepthfirst")
 *             .type("Pooled")
 *             .maximumSessionsAllowed(50)
 *             .loadBalancerType("DepthFirst")
 *             .scheduledAgentUpdates(HostPoolScheduledAgentUpdatesArgs.builder()
 *                 .enabled(true)
 *                 .schedules(HostPoolScheduledAgentUpdatesScheduleArgs.builder()
 *                     .dayOfWeek("Saturday")
 *                     .hourOfDay(2)
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleHostPool:
 *     type: azure:desktopvirtualization:HostPool
 *     name: example
 *     properties:
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       name: pooleddepthfirst
 *       friendlyName: pooleddepthfirst
 *       validateEnvironment: true
 *       startVmOnConnect: true
 *       customRdpProperties: audiocapturemode:i:1;audiomode:i:0;
 *       description: 'Acceptance Test: A pooled host pool - pooleddepthfirst'
 *       type: Pooled
 *       maximumSessionsAllowed: 50
 *       loadBalancerType: DepthFirst
 *       scheduledAgentUpdates:
 *         enabled: true
 *         schedules:
 *           - dayOfWeek: Saturday
 *             hourOfDay: 2
 * ```
 * 
 * ## Import
 * Virtual Desktop Host Pools can be imported using the `resource id`, e.g.
 * text
 * ```sh
 * $ pulumi import azure:desktopvirtualization/hostPool:HostPool example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup1/providers/Microsoft.DesktopVirtualization/hostPools/myhostpool
 * ```
 */
public class HostPool internal constructor(
    override val javaResource: com.pulumi.azure.desktopvirtualization.HostPool,
) : KotlinCustomResource(javaResource, HostPoolMapper) {
    /**
     * A valid custom RDP properties string for the Virtual Desktop Host Pool, available properties can be [found in this article](https://docs.microsoft.com/windows-server/remote/remote-desktop-services/clients/rdp-files).
     */
    public val customRdpProperties: Output?
        get() = javaResource.customRdpProperties().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A description for the Virtual Desktop Host Pool.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A friendly name for the Virtual Desktop Host Pool.
     */
    public val friendlyName: Output?
        get() = javaResource.friendlyName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * `BreadthFirst` load balancing distributes new user sessions across all available session hosts in the host pool. Possible values are `BreadthFirst`, `DepthFirst` and `Persistent`.
     * `DepthFirst` load balancing distributes new user sessions to an available session host with the highest number of connections but has not reached its maximum session limit threshold.
     * `Persistent` should be used if the host pool type is `Personal`
     */
    public val loadBalancerType: Output
        get() = javaResource.loadBalancerType().applyValue({ args0 -> args0 })

    /**
     * The location/region where the Virtual Desktop Host Pool is located. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * A valid integer value from 0 to 999999 for the maximum number of users that have concurrent sessions on a session host.
     * Should only be set if the `type` of your Virtual Desktop Host Pool is `Pooled`.
     */
    public val maximumSessionsAllowed: Output?
        get() = javaResource.maximumSessionsAllowed().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Virtual Desktop Host Pool. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * `Automatic` assignment – The service will select an available host and assign it to an user. Possible values are `Automatic` and `Direct`. `Direct` Assignment – Admin selects a specific host to assign to an user. Changing this forces a new resource to be created.
     * > **NOTE:** `personal_desktop_assignment_type` is required if the `type` of your Virtual Desktop Host Pool is `Personal`
     */
    public val personalDesktopAssignmentType: Output?
        get() = javaResource.personalDesktopAssignmentType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Option to specify the preferred Application Group type for the Virtual Desktop Host Pool. Valid options are `None`, `Desktop` or `RailApplications`. Default is `Desktop`. Changing this forces a new resource to be created.
     */
    public val preferredAppGroupType: Output?
        get() = javaResource.preferredAppGroupType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether public network access is allowed for the Virtual Desktop Host Pool. Possible values are `Enabled`, `Disabled`, `EnabledForClientsOnly` and `EnabledForSessionHostsOnly`. Defaults to `Enabled`.
     */
    public val publicNetworkAccess: Output?
        get() = javaResource.publicNetworkAccess().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * A `scheduled_agent_updates` block as defined below. This enables control of when Agent Updates will be applied to Session Hosts.
     */
    public val scheduledAgentUpdates: Output?
        get() = javaResource.scheduledAgentUpdates().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Enables or disables the Start VM on Connection Feature. Defaults to `false`.
     */
    public val startVmOnConnect: Output?
        get() = javaResource.startVmOnConnect().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The type of the Virtual Desktop Host Pool. Valid options are `Personal` or `Pooled`. Changing the type forces a new resource to be created.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * Allows you to test service changes before they are deployed to production. Defaults to `false`.
     */
    public val validateEnvironment: Output?
        get() = javaResource.validateEnvironment().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A VM template for session hosts configuration within hostpool. This is a JSON string.
     */
    public val vmTemplate: Output?
        get() = javaResource.vmTemplate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object HostPoolMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.desktopvirtualization.HostPool::class == javaResource::class

    override fun map(javaResource: Resource): HostPool = HostPool(
        javaResource as
            com.pulumi.azure.desktopvirtualization.HostPool,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy