com.azure.resourcemanager.compute.models.PriorityMixPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Specifies the target splits for Spot and Regular priority VMs within a scale set with flexible orchestration mode.
* With this property the customer is able to specify the base number of regular priority VMs created as the VMSS flex
* instance scales out and the split between Spot and Regular priority VMs after this base target has been reached.
*/
@Fluent
public final class PriorityMixPolicy implements JsonSerializable {
/*
* The base number of regular priority VMs that will be created in this scale set as it scales out.
*/
private Integer baseRegularPriorityCount;
/*
* The percentage of VM instances, after the base regular priority count has been reached, that are expected to use
* regular priority.
*/
private Integer regularPriorityPercentageAboveBase;
/**
* Creates an instance of PriorityMixPolicy class.
*/
public PriorityMixPolicy() {
}
/**
* Get the baseRegularPriorityCount property: The base number of regular priority VMs that will be created in this
* scale set as it scales out.
*
* @return the baseRegularPriorityCount value.
*/
public Integer baseRegularPriorityCount() {
return this.baseRegularPriorityCount;
}
/**
* Set the baseRegularPriorityCount property: The base number of regular priority VMs that will be created in this
* scale set as it scales out.
*
* @param baseRegularPriorityCount the baseRegularPriorityCount value to set.
* @return the PriorityMixPolicy object itself.
*/
public PriorityMixPolicy withBaseRegularPriorityCount(Integer baseRegularPriorityCount) {
this.baseRegularPriorityCount = baseRegularPriorityCount;
return this;
}
/**
* Get the regularPriorityPercentageAboveBase property: The percentage of VM instances, after the base regular
* priority count has been reached, that are expected to use regular priority.
*
* @return the regularPriorityPercentageAboveBase value.
*/
public Integer regularPriorityPercentageAboveBase() {
return this.regularPriorityPercentageAboveBase;
}
/**
* Set the regularPriorityPercentageAboveBase property: The percentage of VM instances, after the base regular
* priority count has been reached, that are expected to use regular priority.
*
* @param regularPriorityPercentageAboveBase the regularPriorityPercentageAboveBase value to set.
* @return the PriorityMixPolicy object itself.
*/
public PriorityMixPolicy withRegularPriorityPercentageAboveBase(Integer regularPriorityPercentageAboveBase) {
this.regularPriorityPercentageAboveBase = regularPriorityPercentageAboveBase;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeNumberField("baseRegularPriorityCount", this.baseRegularPriorityCount);
jsonWriter.writeNumberField("regularPriorityPercentageAboveBase", this.regularPriorityPercentageAboveBase);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of PriorityMixPolicy from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of PriorityMixPolicy 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 PriorityMixPolicy.
*/
public static PriorityMixPolicy fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
PriorityMixPolicy deserializedPriorityMixPolicy = new PriorityMixPolicy();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("baseRegularPriorityCount".equals(fieldName)) {
deserializedPriorityMixPolicy.baseRegularPriorityCount = reader.getNullable(JsonReader::getInt);
} else if ("regularPriorityPercentageAboveBase".equals(fieldName)) {
deserializedPriorityMixPolicy.regularPriorityPercentageAboveBase
= reader.getNullable(JsonReader::getInt);
} else {
reader.skipChildren();
}
}
return deserializedPriorityMixPolicy;
});
}
}