com.azure.resourcemanager.compute.models.BillingProfile 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 billing related details of a Azure Spot VM or VMSS. Minimum api-version: 2019-03-01.
*/
@Fluent
public final class BillingProfile implements JsonSerializable {
/*
* Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars.
*
This price will be compared with the current Azure Spot price for the VM size. Also, the prices are
* compared at the time of create/update of Azure Spot VM/VMSS and the operation will only succeed if the maxPrice
* is greater than the current Azure Spot price.
The maxPrice will also be used for evicting a Azure Spot
* VM/VMSS if the current Azure Spot price goes beyond the maxPrice after creation of VM/VMSS.
Possible
* values are:
- Any decimal value greater than zero. Example: 0.01538
-1 – indicates default
* price to be up-to on-demand.
You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS
* should not be evicted for price reasons. Also, the default max price is -1 if it is not provided by you.
*
Minimum api-version: 2019-03-01.
*/
private Double maxPrice;
/**
* Creates an instance of BillingProfile class.
*/
public BillingProfile() {
}
/**
* Get the maxPrice property: Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This
* price is in US Dollars. <br><br> This price will be compared with the current Azure Spot price for
* the VM size. Also, the prices are compared at the time of create/update of Azure Spot VM/VMSS and the operation
* will only succeed if the maxPrice is greater than the current Azure Spot price. <br><br> The maxPrice
* will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice
* after creation of VM/VMSS. <br><br> Possible values are: <br><br> - Any decimal value
* greater than zero. Example: 0.01538 <br><br> -1 – indicates default price to be up-to on-demand.
* <br><br> You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted
* for price reasons. Also, the default max price is -1 if it is not provided by you. <br><br>Minimum
* api-version: 2019-03-01.
*
* @return the maxPrice value.
*/
public Double maxPrice() {
return this.maxPrice;
}
/**
* Set the maxPrice property: Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This
* price is in US Dollars. <br><br> This price will be compared with the current Azure Spot price for
* the VM size. Also, the prices are compared at the time of create/update of Azure Spot VM/VMSS and the operation
* will only succeed if the maxPrice is greater than the current Azure Spot price. <br><br> The maxPrice
* will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice
* after creation of VM/VMSS. <br><br> Possible values are: <br><br> - Any decimal value
* greater than zero. Example: 0.01538 <br><br> -1 – indicates default price to be up-to on-demand.
* <br><br> You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted
* for price reasons. Also, the default max price is -1 if it is not provided by you. <br><br>Minimum
* api-version: 2019-03-01.
*
* @param maxPrice the maxPrice value to set.
* @return the BillingProfile object itself.
*/
public BillingProfile withMaxPrice(Double maxPrice) {
this.maxPrice = maxPrice;
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("maxPrice", this.maxPrice);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of BillingProfile from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of BillingProfile 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 BillingProfile.
*/
public static BillingProfile fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
BillingProfile deserializedBillingProfile = new BillingProfile();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("maxPrice".equals(fieldName)) {
deserializedBillingProfile.maxPrice = reader.getNullable(JsonReader::getDouble);
} else {
reader.skipChildren();
}
}
return deserializedBillingProfile;
});
}
}