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

com.pulumi.azure.desktopvirtualization.ScalingPlan Maven / Gradle / Ivy

// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.desktopvirtualization;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.desktopvirtualization.ScalingPlanArgs;
import com.pulumi.azure.desktopvirtualization.inputs.ScalingPlanState;
import com.pulumi.azure.desktopvirtualization.outputs.ScalingPlanHostPool;
import com.pulumi.azure.desktopvirtualization.outputs.ScalingPlanSchedule;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * 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
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * 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());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## 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 * ``` * */ @ResourceType(type="azure:desktopvirtualization/scalingPlan:ScalingPlan") public class ScalingPlan extends com.pulumi.resources.CustomResource { /** * A description of the Scaling Plan. * */ @Export(name="description", refs={String.class}, tree="[0]") private Output description; /** * @return A description of the Scaling Plan. * */ public Output> description() { return Codegen.optional(this.description); } /** * The name of the tag associated with the VMs you want to exclude from autoscaling. * */ @Export(name="exclusionTag", refs={String.class}, tree="[0]") private Output exclusionTag; /** * @return The name of the tag associated with the VMs you want to exclude from autoscaling. * */ public Output> exclusionTag() { return Codegen.optional(this.exclusionTag); } /** * Friendly name of the Scaling Plan. * */ @Export(name="friendlyName", refs={String.class}, tree="[0]") private Output friendlyName; /** * @return Friendly name of the Scaling Plan. * */ public Output> friendlyName() { return Codegen.optional(this.friendlyName); } /** * One or more `host_pool` blocks as defined below. * */ @Export(name="hostPools", refs={List.class,ScalingPlanHostPool.class}, tree="[0,1]") private Output> hostPools; /** * @return One or more `host_pool` blocks as defined below. * */ public Output> hostPools() { return this.hostPools; } /** * The Azure Region where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created. * */ @Export(name="location", refs={String.class}, tree="[0]") private Output location; /** * @return The Azure Region where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created. * */ public Output location() { return this.location; } /** * The name which should be used for this Virtual Desktop Scaling Plan . Changing this forces a new Virtual Desktop Scaling Plan to be created. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name which should be used for this Virtual Desktop Scaling Plan . Changing this forces a new Virtual Desktop Scaling Plan to be created. * */ public Output name() { return this.name; } /** * 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. * */ @Export(name="resourceGroupName", refs={String.class}, tree="[0]") private Output resourceGroupName; /** * @return 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. * */ public Output resourceGroupName() { return this.resourceGroupName; } /** * One or more `schedule` blocks as defined below. * */ @Export(name="schedules", refs={List.class,ScalingPlanSchedule.class}, tree="[0,1]") private Output> schedules; /** * @return One or more `schedule` blocks as defined below. * */ public Output> schedules() { return this.schedules; } /** * A mapping of tags which should be assigned to the Virtual Desktop Scaling Plan . * */ @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tags; /** * @return A mapping of tags which should be assigned to the Virtual Desktop Scaling Plan . * */ public Output>> tags() { return Codegen.optional(this.tags); } /** * 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/). * */ @Export(name="timeZone", refs={String.class}, tree="[0]") private Output timeZone; /** * @return 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 Output timeZone() { return this.timeZone; } /** * * @param name The _unique_ name of the resulting resource. */ public ScalingPlan(java.lang.String name) { this(name, ScalingPlanArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public ScalingPlan(java.lang.String name, ScalingPlanArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public ScalingPlan(java.lang.String name, ScalingPlanArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:desktopvirtualization/scalingPlan:ScalingPlan", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private ScalingPlan(java.lang.String name, Output id, @Nullable ScalingPlanState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:desktopvirtualization/scalingPlan:ScalingPlan", name, state, makeResourceOptions(options, id), false); } private static ScalingPlanArgs makeArgs(ScalingPlanArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? ScalingPlanArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state * @param options Optional settings to control the behavior of the CustomResource. */ public static ScalingPlan get(java.lang.String name, Output id, @Nullable ScalingPlanState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new ScalingPlan(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy