
com.azure.resourcemanager.devcenter.models.RecommendedMachineConfiguration Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.devcenter.models;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Properties for a recommended machine configuration.
*/
@Immutable
public final class RecommendedMachineConfiguration implements JsonSerializable {
/*
* Recommended memory range.
*/
private ResourceRange memory;
/*
* Recommended vCPU range.
*/
private ResourceRange vCPUs;
/**
* Creates an instance of RecommendedMachineConfiguration class.
*/
public RecommendedMachineConfiguration() {
}
/**
* Get the memory property: Recommended memory range.
*
* @return the memory value.
*/
public ResourceRange memory() {
return this.memory;
}
/**
* Get the vCPUs property: Recommended vCPU range.
*
* @return the vCPUs value.
*/
public ResourceRange vCPUs() {
return this.vCPUs;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (memory() != null) {
memory().validate();
}
if (vCPUs() != null) {
vCPUs().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of RecommendedMachineConfiguration from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of RecommendedMachineConfiguration 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 RecommendedMachineConfiguration.
*/
public static RecommendedMachineConfiguration fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
RecommendedMachineConfiguration deserializedRecommendedMachineConfiguration
= new RecommendedMachineConfiguration();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("memory".equals(fieldName)) {
deserializedRecommendedMachineConfiguration.memory = ResourceRange.fromJson(reader);
} else if ("vCPUs".equals(fieldName)) {
deserializedRecommendedMachineConfiguration.vCPUs = ResourceRange.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedRecommendedMachineConfiguration;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy