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

com.pulumi.azure.desktopvirtualization.kotlin.ScalingPlanArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.desktopvirtualization.kotlin

import com.pulumi.azure.desktopvirtualization.ScalingPlanArgs.builder
import com.pulumi.azure.desktopvirtualization.kotlin.inputs.ScalingPlanHostPoolArgs
import com.pulumi.azure.desktopvirtualization.kotlin.inputs.ScalingPlanHostPoolArgsBuilder
import com.pulumi.azure.desktopvirtualization.kotlin.inputs.ScalingPlanScheduleArgs
import com.pulumi.azure.desktopvirtualization.kotlin.inputs.ScalingPlanScheduleArgsBuilder
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.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Virtual Desktop Scaling Plan.
 * ## Disclaimers
 * > **Note** Scaling Plans are currently in preview and are only supported in a limited number of regions. Both the Scaling Plan and any referenced Host Pools must be deployed in a supported region. [Autoscale (preview) for Azure Virtual Desktop host pools](https://docs.microsoft.com/azure/virtual-desktop/autoscale-scaling-plan).
 * > **Note** Scaling Plans require specific permissions to be granted to the Windows Virtual Desktop application before a 'host_pool' can be configured. [Required Permissions for Scaling Plans](https://docs.microsoft.com/azure/virtual-desktop/autoscale-scaling-plan#create-a-custom-rbac-role).
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as azuread from "@pulumi/azuread";
 * import * as random from "@pulumi/random";
 * const exampleRandomUuid = new random.RandomUuid("example", {});
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleRoleDefinition = new azure.authorization.RoleDefinition("example", {
 *     name: "AVD-AutoScale",
 *     scope: exampleResourceGroup.id,
 *     description: "AVD AutoScale Role",
 *     permissions: [{
 *         actions: [
 *             "Microsoft.Insights/eventtypes/values/read",
 *             "Microsoft.Compute/virtualMachines/deallocate/action",
 *             "Microsoft.Compute/virtualMachines/restart/action",
 *             "Microsoft.Compute/virtualMachines/powerOff/action",
 *             "Microsoft.Compute/virtualMachines/start/action",
 *             "Microsoft.Compute/virtualMachines/read",
 *             "Microsoft.DesktopVirtualization/hostpools/read",
 *             "Microsoft.DesktopVirtualization/hostpools/write",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/read",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/write",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/delete",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/action",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read",
 *         ],
 *         notActions: [],
 *     }],
 *     assignableScopes: [exampleResourceGroup.id],
 * });
 * const example = azuread.getServicePrincipal({
 *     displayName: "Azure Virtual Desktop",
 * });
 * const exampleAssignment = new azure.authorization.Assignment("example", {
 *     name: exampleRandomUuid.result,
 *     scope: exampleResourceGroup.id,
 *     roleDefinitionId: exampleRoleDefinition.roleDefinitionResourceId,
 *     principalId: example.then(example => example.id),
 *     skipServicePrincipalAadCheck: true,
 * });
 * const exampleHostPool = new azure.desktopvirtualization.HostPool("example", {
 *     name: "example-hostpool",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     type: "Pooled",
 *     validateEnvironment: true,
 *     loadBalancerType: "BreadthFirst",
 * });
 * const exampleScalingPlan = new azure.desktopvirtualization.ScalingPlan("example", {
 *     name: "example-scaling-plan",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     friendlyName: "Scaling Plan Example",
 *     description: "Example Scaling Plan",
 *     timeZone: "GMT Standard Time",
 *     schedules: [{
 *         name: "Weekdays",
 *         daysOfWeeks: [
 *             "Monday",
 *             "Tuesday",
 *             "Wednesday",
 *             "Thursday",
 *             "Friday",
 *         ],
 *         rampUpStartTime: "05:00",
 *         rampUpLoadBalancingAlgorithm: "BreadthFirst",
 *         rampUpMinimumHostsPercent: 20,
 *         rampUpCapacityThresholdPercent: 10,
 *         peakStartTime: "09:00",
 *         peakLoadBalancingAlgorithm: "BreadthFirst",
 *         rampDownStartTime: "19:00",
 *         rampDownLoadBalancingAlgorithm: "DepthFirst",
 *         rampDownMinimumHostsPercent: 10,
 *         rampDownForceLogoffUsers: false,
 *         rampDownWaitTimeMinutes: 45,
 *         rampDownNotificationMessage: "Please log off in the next 45 minutes...",
 *         rampDownCapacityThresholdPercent: 5,
 *         rampDownStopHostsWhen: "ZeroSessions",
 *         offPeakStartTime: "22:00",
 *         offPeakLoadBalancingAlgorithm: "DepthFirst",
 *     }],
 *     hostPools: [{
 *         hostpoolId: exampleHostPool.id,
 *         scalingPlanEnabled: true,
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_azuread as azuread
 * import pulumi_random as random
 * example_random_uuid = random.RandomUuid("example")
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_role_definition = azure.authorization.RoleDefinition("example",
 *     name="AVD-AutoScale",
 *     scope=example_resource_group.id,
 *     description="AVD AutoScale Role",
 *     permissions=[{
 *         "actions": [
 *             "Microsoft.Insights/eventtypes/values/read",
 *             "Microsoft.Compute/virtualMachines/deallocate/action",
 *             "Microsoft.Compute/virtualMachines/restart/action",
 *             "Microsoft.Compute/virtualMachines/powerOff/action",
 *             "Microsoft.Compute/virtualMachines/start/action",
 *             "Microsoft.Compute/virtualMachines/read",
 *             "Microsoft.DesktopVirtualization/hostpools/read",
 *             "Microsoft.DesktopVirtualization/hostpools/write",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/read",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/write",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/delete",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/action",
 *             "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read",
 *         ],
 *         "not_actions": [],
 *     }],
 *     assignable_scopes=[example_resource_group.id])
 * example = azuread.get_service_principal(display_name="Azure Virtual Desktop")
 * example_assignment = azure.authorization.Assignment("example",
 *     name=example_random_uuid.result,
 *     scope=example_resource_group.id,
 *     role_definition_id=example_role_definition.role_definition_resource_id,
 *     principal_id=example.id,
 *     skip_service_principal_aad_check=True)
 * example_host_pool = azure.desktopvirtualization.HostPool("example",
 *     name="example-hostpool",
 *     location=example_resource_group.location,
 *     resource_group_name=example_resource_group.name,
 *     type="Pooled",
 *     validate_environment=True,
 *     load_balancer_type="BreadthFirst")
 * example_scaling_plan = azure.desktopvirtualization.ScalingPlan("example",
 *     name="example-scaling-plan",
 *     location=example_resource_group.location,
 *     resource_group_name=example_resource_group.name,
 *     friendly_name="Scaling Plan Example",
 *     description="Example Scaling Plan",
 *     time_zone="GMT Standard Time",
 *     schedules=[{
 *         "name": "Weekdays",
 *         "days_of_weeks": [
 *             "Monday",
 *             "Tuesday",
 *             "Wednesday",
 *             "Thursday",
 *             "Friday",
 *         ],
 *         "ramp_up_start_time": "05:00",
 *         "ramp_up_load_balancing_algorithm": "BreadthFirst",
 *         "ramp_up_minimum_hosts_percent": 20,
 *         "ramp_up_capacity_threshold_percent": 10,
 *         "peak_start_time": "09:00",
 *         "peak_load_balancing_algorithm": "BreadthFirst",
 *         "ramp_down_start_time": "19:00",
 *         "ramp_down_load_balancing_algorithm": "DepthFirst",
 *         "ramp_down_minimum_hosts_percent": 10,
 *         "ramp_down_force_logoff_users": False,
 *         "ramp_down_wait_time_minutes": 45,
 *         "ramp_down_notification_message": "Please log off in the next 45 minutes...",
 *         "ramp_down_capacity_threshold_percent": 5,
 *         "ramp_down_stop_hosts_when": "ZeroSessions",
 *         "off_peak_start_time": "22:00",
 *         "off_peak_load_balancing_algorithm": "DepthFirst",
 *     }],
 *     host_pools=[{
 *         "hostpool_id": example_host_pool.id,
 *         "scaling_plan_enabled": True,
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using AzureAD = Pulumi.AzureAD;
 * using Random = Pulumi.Random;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleRandomUuid = new Random.RandomUuid("example");
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleRoleDefinition = new Azure.Authorization.RoleDefinition("example", new()
 *     {
 *         Name = "AVD-AutoScale",
 *         Scope = exampleResourceGroup.Id,
 *         Description = "AVD AutoScale Role",
 *         Permissions = new[]
 *         {
 *             new Azure.Authorization.Inputs.RoleDefinitionPermissionArgs
 *             {
 *                 Actions = new[]
 *                 {
 *                     "Microsoft.Insights/eventtypes/values/read",
 *                     "Microsoft.Compute/virtualMachines/deallocate/action",
 *                     "Microsoft.Compute/virtualMachines/restart/action",
 *                     "Microsoft.Compute/virtualMachines/powerOff/action",
 *                     "Microsoft.Compute/virtualMachines/start/action",
 *                     "Microsoft.Compute/virtualMachines/read",
 *                     "Microsoft.DesktopVirtualization/hostpools/read",
 *                     "Microsoft.DesktopVirtualization/hostpools/write",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/read",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/write",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/delete",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/action",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read",
 *                 },
 *                 NotActions = new() { },
 *             },
 *         },
 *         AssignableScopes = new[]
 *         {
 *             exampleResourceGroup.Id,
 *         },
 *     });
 *     var example = AzureAD.GetServicePrincipal.Invoke(new()
 *     {
 *         DisplayName = "Azure Virtual Desktop",
 *     });
 *     var exampleAssignment = new Azure.Authorization.Assignment("example", new()
 *     {
 *         Name = exampleRandomUuid.Result,
 *         Scope = exampleResourceGroup.Id,
 *         RoleDefinitionId = exampleRoleDefinition.RoleDefinitionResourceId,
 *         PrincipalId = example.Apply(getServicePrincipalResult => getServicePrincipalResult.Id),
 *         SkipServicePrincipalAadCheck = true,
 *     });
 *     var exampleHostPool = new Azure.DesktopVirtualization.HostPool("example", new()
 *     {
 *         Name = "example-hostpool",
 *         Location = exampleResourceGroup.Location,
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Type = "Pooled",
 *         ValidateEnvironment = true,
 *         LoadBalancerType = "BreadthFirst",
 *     });
 *     var exampleScalingPlan = new Azure.DesktopVirtualization.ScalingPlan("example", new()
 *     {
 *         Name = "example-scaling-plan",
 *         Location = exampleResourceGroup.Location,
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         FriendlyName = "Scaling Plan Example",
 *         Description = "Example Scaling Plan",
 *         TimeZone = "GMT Standard Time",
 *         Schedules = new[]
 *         {
 *             new Azure.DesktopVirtualization.Inputs.ScalingPlanScheduleArgs
 *             {
 *                 Name = "Weekdays",
 *                 DaysOfWeeks = new[]
 *                 {
 *                     "Monday",
 *                     "Tuesday",
 *                     "Wednesday",
 *                     "Thursday",
 *                     "Friday",
 *                 },
 *                 RampUpStartTime = "05:00",
 *                 RampUpLoadBalancingAlgorithm = "BreadthFirst",
 *                 RampUpMinimumHostsPercent = 20,
 *                 RampUpCapacityThresholdPercent = 10,
 *                 PeakStartTime = "09:00",
 *                 PeakLoadBalancingAlgorithm = "BreadthFirst",
 *                 RampDownStartTime = "19:00",
 *                 RampDownLoadBalancingAlgorithm = "DepthFirst",
 *                 RampDownMinimumHostsPercent = 10,
 *                 RampDownForceLogoffUsers = false,
 *                 RampDownWaitTimeMinutes = 45,
 *                 RampDownNotificationMessage = "Please log off in the next 45 minutes...",
 *                 RampDownCapacityThresholdPercent = 5,
 *                 RampDownStopHostsWhen = "ZeroSessions",
 *                 OffPeakStartTime = "22:00",
 *                 OffPeakLoadBalancingAlgorithm = "DepthFirst",
 *             },
 *         },
 *         HostPools = new[]
 *         {
 *             new Azure.DesktopVirtualization.Inputs.ScalingPlanHostPoolArgs
 *             {
 *                 HostpoolId = exampleHostPool.Id,
 *                 ScalingPlanEnabled = true,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/desktopvirtualization"
 * 	"github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
 * 	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		exampleRandomUuid, err := random.NewRandomUuid(ctx, "example", nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleRoleDefinition, err := authorization.NewRoleDefinition(ctx, "example", &authorization.RoleDefinitionArgs{
 * 			Name:        pulumi.String("AVD-AutoScale"),
 * 			Scope:       exampleResourceGroup.ID(),
 * 			Description: pulumi.String("AVD AutoScale Role"),
 * 			Permissions: authorization.RoleDefinitionPermissionArray{
 * 				&authorization.RoleDefinitionPermissionArgs{
 * 					Actions: pulumi.StringArray{
 * 						pulumi.String("Microsoft.Insights/eventtypes/values/read"),
 * 						pulumi.String("Microsoft.Compute/virtualMachines/deallocate/action"),
 * 						pulumi.String("Microsoft.Compute/virtualMachines/restart/action"),
 * 						pulumi.String("Microsoft.Compute/virtualMachines/powerOff/action"),
 * 						pulumi.String("Microsoft.Compute/virtualMachines/start/action"),
 * 						pulumi.String("Microsoft.Compute/virtualMachines/read"),
 * 						pulumi.String("Microsoft.DesktopVirtualization/hostpools/read"),
 * 						pulumi.String("Microsoft.DesktopVirtualization/hostpools/write"),
 * 						pulumi.String("Microsoft.DesktopVirtualization/hostpools/sessionhosts/read"),
 * 						pulumi.String("Microsoft.DesktopVirtualization/hostpools/sessionhosts/write"),
 * 						pulumi.String("Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/delete"),
 * 						pulumi.String("Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read"),
 * 						pulumi.String("Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/action"),
 * 						pulumi.String("Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read"),
 * 					},
 * 					NotActions: pulumi.StringArray{},
 * 				},
 * 			},
 * 			AssignableScopes: pulumi.StringArray{
 * 				exampleResourceGroup.ID(),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := azuread.LookupServicePrincipal(ctx, &azuread.LookupServicePrincipalArgs{
 * 			DisplayName: pulumi.StringRef("Azure Virtual Desktop"),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = authorization.NewAssignment(ctx, "example", &authorization.AssignmentArgs{
 * 			Name:                         exampleRandomUuid.Result,
 * 			Scope:                        exampleResourceGroup.ID(),
 * 			RoleDefinitionId:             exampleRoleDefinition.RoleDefinitionResourceId,
 * 			PrincipalId:                  pulumi.String(example.Id),
 * 			SkipServicePrincipalAadCheck: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleHostPool, err := desktopvirtualization.NewHostPool(ctx, "example", &desktopvirtualization.HostPoolArgs{
 * 			Name:                pulumi.String("example-hostpool"),
 * 			Location:            exampleResourceGroup.Location,
 * 			ResourceGroupName:   exampleResourceGroup.Name,
 * 			Type:                pulumi.String("Pooled"),
 * 			ValidateEnvironment: pulumi.Bool(true),
 * 			LoadBalancerType:    pulumi.String("BreadthFirst"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = desktopvirtualization.NewScalingPlan(ctx, "example", &desktopvirtualization.ScalingPlanArgs{
 * 			Name:              pulumi.String("example-scaling-plan"),
 * 			Location:          exampleResourceGroup.Location,
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			FriendlyName:      pulumi.String("Scaling Plan Example"),
 * 			Description:       pulumi.String("Example Scaling Plan"),
 * 			TimeZone:          pulumi.String("GMT Standard Time"),
 * 			Schedules: desktopvirtualization.ScalingPlanScheduleArray{
 * 				&desktopvirtualization.ScalingPlanScheduleArgs{
 * 					Name: pulumi.String("Weekdays"),
 * 					DaysOfWeeks: pulumi.StringArray{
 * 						pulumi.String("Monday"),
 * 						pulumi.String("Tuesday"),
 * 						pulumi.String("Wednesday"),
 * 						pulumi.String("Thursday"),
 * 						pulumi.String("Friday"),
 * 					},
 * 					RampUpStartTime:                  pulumi.String("05:00"),
 * 					RampUpLoadBalancingAlgorithm:     pulumi.String("BreadthFirst"),
 * 					RampUpMinimumHostsPercent:        pulumi.Int(20),
 * 					RampUpCapacityThresholdPercent:   pulumi.Int(10),
 * 					PeakStartTime:                    pulumi.String("09:00"),
 * 					PeakLoadBalancingAlgorithm:       pulumi.String("BreadthFirst"),
 * 					RampDownStartTime:                pulumi.String("19:00"),
 * 					RampDownLoadBalancingAlgorithm:   pulumi.String("DepthFirst"),
 * 					RampDownMinimumHostsPercent:      pulumi.Int(10),
 * 					RampDownForceLogoffUsers:         pulumi.Bool(false),
 * 					RampDownWaitTimeMinutes:          pulumi.Int(45),
 * 					RampDownNotificationMessage:      pulumi.String("Please log off in the next 45 minutes..."),
 * 					RampDownCapacityThresholdPercent: pulumi.Int(5),
 * 					RampDownStopHostsWhen:            pulumi.String("ZeroSessions"),
 * 					OffPeakStartTime:                 pulumi.String("22:00"),
 * 					OffPeakLoadBalancingAlgorithm:    pulumi.String("DepthFirst"),
 * 				},
 * 			},
 * 			HostPools: desktopvirtualization.ScalingPlanHostPoolArray{
 * 				&desktopvirtualization.ScalingPlanHostPoolArgs{
 * 					HostpoolId:         exampleHostPool.ID(),
 * 					ScalingPlanEnabled: pulumi.Bool(true),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.random.RandomUuid;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.authorization.RoleDefinition;
 * import com.pulumi.azure.authorization.RoleDefinitionArgs;
 * import com.pulumi.azure.authorization.inputs.RoleDefinitionPermissionArgs;
 * import com.pulumi.azuread.AzureadFunctions;
 * import com.pulumi.azuread.inputs.GetServicePrincipalArgs;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * import com.pulumi.azure.desktopvirtualization.HostPool;
 * import com.pulumi.azure.desktopvirtualization.HostPoolArgs;
 * import com.pulumi.azure.desktopvirtualization.ScalingPlan;
 * import com.pulumi.azure.desktopvirtualization.ScalingPlanArgs;
 * import com.pulumi.azure.desktopvirtualization.inputs.ScalingPlanScheduleArgs;
 * import com.pulumi.azure.desktopvirtualization.inputs.ScalingPlanHostPoolArgs;
 * 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 exampleRandomUuid = new RandomUuid("exampleRandomUuid");
 *         var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleRoleDefinition = new RoleDefinition("exampleRoleDefinition", RoleDefinitionArgs.builder()
 *             .name("AVD-AutoScale")
 *             .scope(exampleResourceGroup.id())
 *             .description("AVD AutoScale Role")
 *             .permissions(RoleDefinitionPermissionArgs.builder()
 *                 .actions(
 *                     "Microsoft.Insights/eventtypes/values/read",
 *                     "Microsoft.Compute/virtualMachines/deallocate/action",
 *                     "Microsoft.Compute/virtualMachines/restart/action",
 *                     "Microsoft.Compute/virtualMachines/powerOff/action",
 *                     "Microsoft.Compute/virtualMachines/start/action",
 *                     "Microsoft.Compute/virtualMachines/read",
 *                     "Microsoft.DesktopVirtualization/hostpools/read",
 *                     "Microsoft.DesktopVirtualization/hostpools/write",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/read",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/write",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/delete",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/action",
 *                     "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read")
 *                 .notActions()
 *                 .build())
 *             .assignableScopes(exampleResourceGroup.id())
 *             .build());
 *         final var example = AzureadFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
 *             .displayName("Azure Virtual Desktop")
 *             .build());
 *         var exampleAssignment = new Assignment("exampleAssignment", AssignmentArgs.builder()
 *             .name(exampleRandomUuid.result())
 *             .scope(exampleResourceGroup.id())
 *             .roleDefinitionId(exampleRoleDefinition.roleDefinitionResourceId())
 *             .principalId(example.applyValue(getServicePrincipalResult -> getServicePrincipalResult.id()))
 *             .skipServicePrincipalAadCheck(true)
 *             .build());
 *         var exampleHostPool = new HostPool("exampleHostPool", HostPoolArgs.builder()
 *             .name("example-hostpool")
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .type("Pooled")
 *             .validateEnvironment(true)
 *             .loadBalancerType("BreadthFirst")
 *             .build());
 *         var exampleScalingPlan = new ScalingPlan("exampleScalingPlan", ScalingPlanArgs.builder()
 *             .name("example-scaling-plan")
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .friendlyName("Scaling Plan Example")
 *             .description("Example Scaling Plan")
 *             .timeZone("GMT Standard Time")
 *             .schedules(ScalingPlanScheduleArgs.builder()
 *                 .name("Weekdays")
 *                 .daysOfWeeks(
 *                     "Monday",
 *                     "Tuesday",
 *                     "Wednesday",
 *                     "Thursday",
 *                     "Friday")
 *                 .rampUpStartTime("05:00")
 *                 .rampUpLoadBalancingAlgorithm("BreadthFirst")
 *                 .rampUpMinimumHostsPercent(20)
 *                 .rampUpCapacityThresholdPercent(10)
 *                 .peakStartTime("09:00")
 *                 .peakLoadBalancingAlgorithm("BreadthFirst")
 *                 .rampDownStartTime("19:00")
 *                 .rampDownLoadBalancingAlgorithm("DepthFirst")
 *                 .rampDownMinimumHostsPercent(10)
 *                 .rampDownForceLogoffUsers(false)
 *                 .rampDownWaitTimeMinutes(45)
 *                 .rampDownNotificationMessage("Please log off in the next 45 minutes...")
 *                 .rampDownCapacityThresholdPercent(5)
 *                 .rampDownStopHostsWhen("ZeroSessions")
 *                 .offPeakStartTime("22:00")
 *                 .offPeakLoadBalancingAlgorithm("DepthFirst")
 *                 .build())
 *             .hostPools(ScalingPlanHostPoolArgs.builder()
 *                 .hostpoolId(exampleHostPool.id())
 *                 .scalingPlanEnabled(true)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleRandomUuid:
 *     type: random:RandomUuid
 *     name: example
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleRoleDefinition:
 *     type: azure:authorization:RoleDefinition
 *     name: example
 *     properties:
 *       name: AVD-AutoScale
 *       scope: ${exampleResourceGroup.id}
 *       description: AVD AutoScale Role
 *       permissions:
 *         - actions:
 *             - Microsoft.Insights/eventtypes/values/read
 *             - Microsoft.Compute/virtualMachines/deallocate/action
 *             - Microsoft.Compute/virtualMachines/restart/action
 *             - Microsoft.Compute/virtualMachines/powerOff/action
 *             - Microsoft.Compute/virtualMachines/start/action
 *             - Microsoft.Compute/virtualMachines/read
 *             - Microsoft.DesktopVirtualization/hostpools/read
 *             - Microsoft.DesktopVirtualization/hostpools/write
 *             - Microsoft.DesktopVirtualization/hostpools/sessionhosts/read
 *             - Microsoft.DesktopVirtualization/hostpools/sessionhosts/write
 *             - Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/delete
 *             - Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read
 *             - Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/action
 *             - Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read
 *           notActions: []
 *       assignableScopes:
 *         - ${exampleResourceGroup.id}
 *   exampleAssignment:
 *     type: azure:authorization:Assignment
 *     name: example
 *     properties:
 *       name: ${exampleRandomUuid.result}
 *       scope: ${exampleResourceGroup.id}
 *       roleDefinitionId: ${exampleRoleDefinition.roleDefinitionResourceId}
 *       principalId: ${example.id}
 *       skipServicePrincipalAadCheck: true
 *   exampleHostPool:
 *     type: azure:desktopvirtualization:HostPool
 *     name: example
 *     properties:
 *       name: example-hostpool
 *       location: ${exampleResourceGroup.location}
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       type: Pooled
 *       validateEnvironment: true
 *       loadBalancerType: BreadthFirst
 *   exampleScalingPlan:
 *     type: azure:desktopvirtualization:ScalingPlan
 *     name: example
 *     properties:
 *       name: example-scaling-plan
 *       location: ${exampleResourceGroup.location}
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       friendlyName: Scaling Plan Example
 *       description: Example Scaling Plan
 *       timeZone: GMT Standard Time
 *       schedules:
 *         - name: Weekdays
 *           daysOfWeeks:
 *             - Monday
 *             - Tuesday
 *             - Wednesday
 *             - Thursday
 *             - Friday
 *           rampUpStartTime: 05:00
 *           rampUpLoadBalancingAlgorithm: BreadthFirst
 *           rampUpMinimumHostsPercent: 20
 *           rampUpCapacityThresholdPercent: 10
 *           peakStartTime: 09:00
 *           peakLoadBalancingAlgorithm: BreadthFirst
 *           rampDownStartTime: 19:00
 *           rampDownLoadBalancingAlgorithm: DepthFirst
 *           rampDownMinimumHostsPercent: 10
 *           rampDownForceLogoffUsers: false
 *           rampDownWaitTimeMinutes: 45
 *           rampDownNotificationMessage: Please log off in the next 45 minutes...
 *           rampDownCapacityThresholdPercent: 5
 *           rampDownStopHostsWhen: ZeroSessions
 *           offPeakStartTime: 22:00
 *           offPeakLoadBalancingAlgorithm: DepthFirst
 *       hostPools:
 *         - hostpoolId: ${exampleHostPool.id}
 *           scalingPlanEnabled: true
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azuread:getServicePrincipal
 *       Arguments:
 *         displayName: Azure Virtual Desktop
 * ```
 * 
 * ## Import
 * Virtual Desktop Scaling Plans can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:desktopvirtualization/scalingPlan:ScalingPlan example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/plan1
 * ```
 * @property description A description of the Scaling Plan.
 * @property exclusionTag The name of the tag associated with the VMs you want to exclude from autoscaling.
 * @property friendlyName Friendly name of the Scaling Plan.
 * @property hostPools One or more `host_pool` blocks as defined below.
 * @property location The Azure Region where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created.
 * @property name The name which should be used for this Virtual Desktop Scaling Plan . Changing this forces a new Virtual Desktop Scaling Plan to be created.
 * @property resourceGroupName The name of the Resource Group where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created.
 * @property schedules One or more `schedule` blocks as defined below.
 * @property tags A mapping of tags which should be assigned to the Virtual Desktop Scaling Plan .
 * @property timeZone Specifies the Time Zone which should be used by the Scaling Plan for time based events, [the possible values are defined here](https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/).
 */
public data class ScalingPlanArgs(
    public val description: Output? = null,
    public val exclusionTag: Output? = null,
    public val friendlyName: Output? = null,
    public val hostPools: Output>? = null,
    public val location: Output? = null,
    public val name: Output? = null,
    public val resourceGroupName: Output? = null,
    public val schedules: Output>? = null,
    public val tags: Output>? = null,
    public val timeZone: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.desktopvirtualization.ScalingPlanArgs =
        com.pulumi.azure.desktopvirtualization.ScalingPlanArgs.builder()
            .description(description?.applyValue({ args0 -> args0 }))
            .exclusionTag(exclusionTag?.applyValue({ args0 -> args0 }))
            .friendlyName(friendlyName?.applyValue({ args0 -> args0 }))
            .hostPools(
                hostPools?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .location(location?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .schedules(
                schedules?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .timeZone(timeZone?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [ScalingPlanArgs].
 */
@PulumiTagMarker
public class ScalingPlanArgsBuilder internal constructor() {
    private var description: Output? = null

    private var exclusionTag: Output? = null

    private var friendlyName: Output? = null

    private var hostPools: Output>? = null

    private var location: Output? = null

    private var name: Output? = null

    private var resourceGroupName: Output? = null

    private var schedules: Output>? = null

    private var tags: Output>? = null

    private var timeZone: Output? = null

    /**
     * @param value A description of the Scaling Plan.
     */
    @JvmName("uasdygycllgwtxjm")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value The name of the tag associated with the VMs you want to exclude from autoscaling.
     */
    @JvmName("sqihssxgufyqjoib")
    public suspend fun exclusionTag(`value`: Output) {
        this.exclusionTag = value
    }

    /**
     * @param value Friendly name of the Scaling Plan.
     */
    @JvmName("akldvvqfivvuvomm")
    public suspend fun friendlyName(`value`: Output) {
        this.friendlyName = value
    }

    /**
     * @param value One or more `host_pool` blocks as defined below.
     */
    @JvmName("fgbjuncwkwxqnxjv")
    public suspend fun hostPools(`value`: Output>) {
        this.hostPools = value
    }

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

    /**
     * @param values One or more `host_pool` blocks as defined below.
     */
    @JvmName("swmiiccgjtcirtbi")
    public suspend fun hostPools(values: List>) {
        this.hostPools = Output.all(values)
    }

    /**
     * @param value The Azure Region where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created.
     */
    @JvmName("ngvkwmfqebmdblfr")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

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

    /**
     * @param value The name of the Resource Group where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created.
     */
    @JvmName("awvqqoifojufvfxl")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value One or more `schedule` blocks as defined below.
     */
    @JvmName("qxahnigiyflwyjnv")
    public suspend fun schedules(`value`: Output>) {
        this.schedules = value
    }

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

    /**
     * @param values One or more `schedule` blocks as defined below.
     */
    @JvmName("sxxeqcpegorpipvd")
    public suspend fun schedules(values: List>) {
        this.schedules = Output.all(values)
    }

    /**
     * @param value A mapping of tags which should be assigned to the Virtual Desktop Scaling Plan .
     */
    @JvmName("xcesotkshhbtibkx")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value Specifies the Time Zone which should be used by the Scaling Plan for time based events, [the possible values are defined here](https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/).
     */
    @JvmName("kdpjgpxhlvrbdsin")
    public suspend fun timeZone(`value`: Output) {
        this.timeZone = value
    }

    /**
     * @param value A description of the Scaling Plan.
     */
    @JvmName("jsgcffwywjyhbfoy")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value The name of the tag associated with the VMs you want to exclude from autoscaling.
     */
    @JvmName("oxwgtcqhcludekrs")
    public suspend fun exclusionTag(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.exclusionTag = mapped
    }

    /**
     * @param value Friendly name of the Scaling Plan.
     */
    @JvmName("mjbqshaegcljfulq")
    public suspend fun friendlyName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.friendlyName = mapped
    }

    /**
     * @param value One or more `host_pool` blocks as defined below.
     */
    @JvmName("dqarkvfttgnkxkme")
    public suspend fun hostPools(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.hostPools = mapped
    }

    /**
     * @param argument One or more `host_pool` blocks as defined below.
     */
    @JvmName("ohgtehtljonepesy")
    public suspend fun hostPools(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ScalingPlanHostPoolArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.hostPools = mapped
    }

    /**
     * @param argument One or more `host_pool` blocks as defined below.
     */
    @JvmName("kvpepulggtjwcsxf")
    public suspend fun hostPools(vararg argument: suspend ScalingPlanHostPoolArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            ScalingPlanHostPoolArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.hostPools = mapped
    }

    /**
     * @param argument One or more `host_pool` blocks as defined below.
     */
    @JvmName("sesjappetirxxvld")
    public suspend fun hostPools(argument: suspend ScalingPlanHostPoolArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(ScalingPlanHostPoolArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.hostPools = mapped
    }

    /**
     * @param values One or more `host_pool` blocks as defined below.
     */
    @JvmName("svuieerwlniadirb")
    public suspend fun hostPools(vararg values: ScalingPlanHostPoolArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.hostPools = mapped
    }

    /**
     * @param value The Azure Region where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created.
     */
    @JvmName("wtsyjdwlekprpamx")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

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

    /**
     * @param value The name of the Resource Group where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created.
     */
    @JvmName("swmiqxbaghefaghp")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value One or more `schedule` blocks as defined below.
     */
    @JvmName("qqeoewdyavoiejfk")
    public suspend fun schedules(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.schedules = mapped
    }

    /**
     * @param argument One or more `schedule` blocks as defined below.
     */
    @JvmName("qndbmaurgxsmafub")
    public suspend fun schedules(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ScalingPlanScheduleArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.schedules = mapped
    }

    /**
     * @param argument One or more `schedule` blocks as defined below.
     */
    @JvmName("agwlmtigshoktevb")
    public suspend fun schedules(vararg argument: suspend ScalingPlanScheduleArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            ScalingPlanScheduleArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.schedules = mapped
    }

    /**
     * @param argument One or more `schedule` blocks as defined below.
     */
    @JvmName("tnietqhmevccqncn")
    public suspend fun schedules(argument: suspend ScalingPlanScheduleArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(ScalingPlanScheduleArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.schedules = mapped
    }

    /**
     * @param values One or more `schedule` blocks as defined below.
     */
    @JvmName("nyurxpslatxsgshl")
    public suspend fun schedules(vararg values: ScalingPlanScheduleArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.schedules = mapped
    }

    /**
     * @param value A mapping of tags which should be assigned to the Virtual Desktop Scaling Plan .
     */
    @JvmName("oqyidbvhokiijupk")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags which should be assigned to the Virtual Desktop Scaling Plan .
     */
    @JvmName("lthlijlxjeohuaij")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value Specifies the Time Zone which should be used by the Scaling Plan for time based events, [the possible values are defined here](https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/).
     */
    @JvmName("eoulflmvogcpbhld")
    public suspend fun timeZone(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.timeZone = mapped
    }

    internal fun build(): ScalingPlanArgs = ScalingPlanArgs(
        description = description,
        exclusionTag = exclusionTag,
        friendlyName = friendlyName,
        hostPools = hostPools,
        location = location,
        name = name,
        resourceGroupName = resourceGroupName,
        schedules = schedules,
        tags = tags,
        timeZone = timeZone,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy