Class ScaleInPolicy

java.lang.Object
com.azure.resourcemanager.compute.models.ScaleInPolicy
All Implemented Interfaces:
com.azure.json.JsonSerializable<ScaleInPolicy>

public final class ScaleInPolicy extends Object implements com.azure.json.JsonSerializable<ScaleInPolicy>
Describes a scale-in policy for a virtual machine scale set.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of ScaleInPolicy class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the forceDeletion property: This property allows you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine scale set is being scaled-in.
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of ScaleInPolicy from the JsonReader.
    Get the prioritizeUnhealthyVMs property: This property allows you to prioritize the deletion of unhealthy and inactive VMs when a virtual machine scale set is being scaled-in.
    Get the rules property: The rules to be followed when scaling-in a virtual machine scale set.
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)
    void
    Validates the instance.
    withForceDeletion(Boolean forceDeletion)
    Set the forceDeletion property: This property allows you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine scale set is being scaled-in.
    withPrioritizeUnhealthyVMs(Boolean prioritizeUnhealthyVMs)
    Set the prioritizeUnhealthyVMs property: This property allows you to prioritize the deletion of unhealthy and inactive VMs when a virtual machine scale set is being scaled-in.
    Set the rules property: The rules to be followed when scaling-in a virtual machine scale set.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.azure.json.JsonSerializable

    toJson, toJson, toJsonBytes, toJsonString
  • Constructor Details

    • ScaleInPolicy

      public ScaleInPolicy()
      Creates an instance of ScaleInPolicy class.
  • Method Details

    • rules

      Get the rules property: The rules to be followed when scaling-in a virtual machine scale set. <br><br> Possible values are: <br><br> **Default** When a virtual machine scale set is scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be balanced across Fault Domains as far as possible. Within each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not protected from scale-in. <br><br> **OldestVM** When a virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the oldest virtual machines that are not protected will be chosen for removal. <br><br> **NewestVM** When a virtual machine scale set is being scaled-in, the newest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not protected will be chosen for removal. <br><br>.
      Returns:
      the rules value.
    • withRules

      Set the rules property: The rules to be followed when scaling-in a virtual machine scale set. <br><br> Possible values are: <br><br> **Default** When a virtual machine scale set is scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be balanced across Fault Domains as far as possible. Within each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not protected from scale-in. <br><br> **OldestVM** When a virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the oldest virtual machines that are not protected will be chosen for removal. <br><br> **NewestVM** When a virtual machine scale set is being scaled-in, the newest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not protected will be chosen for removal. <br><br>.
      Parameters:
      rules - the rules value to set.
      Returns:
      the ScaleInPolicy object itself.
    • forceDeletion

      public Boolean forceDeletion()
      Get the forceDeletion property: This property allows you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine scale set is being scaled-in.(Feature in Preview).
      Returns:
      the forceDeletion value.
    • withForceDeletion

      public ScaleInPolicy withForceDeletion(Boolean forceDeletion)
      Set the forceDeletion property: This property allows you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine scale set is being scaled-in.(Feature in Preview).
      Parameters:
      forceDeletion - the forceDeletion value to set.
      Returns:
      the ScaleInPolicy object itself.
    • prioritizeUnhealthyVMs

      public Boolean prioritizeUnhealthyVMs()
      Get the prioritizeUnhealthyVMs property: This property allows you to prioritize the deletion of unhealthy and inactive VMs when a virtual machine scale set is being scaled-in.(Feature in Preview).
      Returns:
      the prioritizeUnhealthyVMs value.
    • withPrioritizeUnhealthyVMs

      public ScaleInPolicy withPrioritizeUnhealthyVMs(Boolean prioritizeUnhealthyVMs)
      Set the prioritizeUnhealthyVMs property: This property allows you to prioritize the deletion of unhealthy and inactive VMs when a virtual machine scale set is being scaled-in.(Feature in Preview).
      Parameters:
      prioritizeUnhealthyVMs - the prioritizeUnhealthyVMs value to set.
      Returns:
      the ScaleInPolicy object itself.
    • validate

      public void validate()
      Validates the instance.
      Throws:
      IllegalArgumentException - thrown if the instance is not valid.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<ScaleInPolicy>
      Throws:
      IOException
    • fromJson

      public static ScaleInPolicy fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of ScaleInPolicy from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of ScaleInPolicy if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IOException - If an error occurs while reading the ScaleInPolicy.