com.azure.resourcemanager.compute.models.Sku 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;
/**
* Describes a virtual machine scale set sku. NOTE: If the new VM SKU is not supported on the hardware the scale set is
* currently on, you need to deallocate the VMs in the scale set before you modify the SKU name.
*/
@Fluent
public final class Sku implements JsonSerializable {
/*
* The sku name.
*/
private String name;
/*
* Specifies the tier of virtual machines in a scale set.
Possible Values:
**Standard**
**Basic**
*/
private String tier;
/*
* Specifies the number of virtual machines in the scale set.
*/
private Long capacity;
/**
* Creates an instance of Sku class.
*/
public Sku() {
}
/**
* Get the name property: The sku name.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: The sku name.
*
* @param name the name value to set.
* @return the Sku object itself.
*/
public Sku withName(String name) {
this.name = name;
return this;
}
/**
* Get the tier property: Specifies the tier of virtual machines in a scale set.<br /><br /> Possible
* Values:<br /><br /> **Standard**<br /><br /> **Basic**.
*
* @return the tier value.
*/
public String tier() {
return this.tier;
}
/**
* Set the tier property: Specifies the tier of virtual machines in a scale set.<br /><br /> Possible
* Values:<br /><br /> **Standard**<br /><br /> **Basic**.
*
* @param tier the tier value to set.
* @return the Sku object itself.
*/
public Sku withTier(String tier) {
this.tier = tier;
return this;
}
/**
* Get the capacity property: Specifies the number of virtual machines in the scale set.
*
* @return the capacity value.
*/
public Long capacity() {
return this.capacity;
}
/**
* Set the capacity property: Specifies the number of virtual machines in the scale set.
*
* @param capacity the capacity value to set.
* @return the Sku object itself.
*/
public Sku withCapacity(Long capacity) {
this.capacity = capacity;
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.writeStringField("name", this.name);
jsonWriter.writeStringField("tier", this.tier);
jsonWriter.writeNumberField("capacity", this.capacity);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of Sku from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of Sku 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 Sku.
*/
public static Sku fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Sku deserializedSku = new Sku();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedSku.name = reader.getString();
} else if ("tier".equals(fieldName)) {
deserializedSku.tier = reader.getString();
} else if ("capacity".equals(fieldName)) {
deserializedSku.capacity = reader.getNullable(JsonReader::getLong);
} else {
reader.skipChildren();
}
}
return deserializedSku;
});
}
}