com.azure.resourcemanager.hdinsight.models.AutoscaleTimeAndCapacity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hdinsight Show documentation
Show all versions of azure-resourcemanager-hdinsight Show documentation
This package contains Microsoft Azure SDK for HDInsight Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Management Client. Package tag package-2024-08-preview.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.hdinsight.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;
/**
* Time and capacity request parameters.
*/
@Fluent
public final class AutoscaleTimeAndCapacity implements JsonSerializable {
/*
* 24-hour time in the form xx:xx
*/
private String time;
/*
* The minimum instance count of the cluster
*/
private Integer minInstanceCount;
/*
* The maximum instance count of the cluster
*/
private Integer maxInstanceCount;
/**
* Creates an instance of AutoscaleTimeAndCapacity class.
*/
public AutoscaleTimeAndCapacity() {
}
/**
* Get the time property: 24-hour time in the form xx:xx.
*
* @return the time value.
*/
public String time() {
return this.time;
}
/**
* Set the time property: 24-hour time in the form xx:xx.
*
* @param time the time value to set.
* @return the AutoscaleTimeAndCapacity object itself.
*/
public AutoscaleTimeAndCapacity withTime(String time) {
this.time = time;
return this;
}
/**
* Get the minInstanceCount property: The minimum instance count of the cluster.
*
* @return the minInstanceCount value.
*/
public Integer minInstanceCount() {
return this.minInstanceCount;
}
/**
* Set the minInstanceCount property: The minimum instance count of the cluster.
*
* @param minInstanceCount the minInstanceCount value to set.
* @return the AutoscaleTimeAndCapacity object itself.
*/
public AutoscaleTimeAndCapacity withMinInstanceCount(Integer minInstanceCount) {
this.minInstanceCount = minInstanceCount;
return this;
}
/**
* Get the maxInstanceCount property: The maximum instance count of the cluster.
*
* @return the maxInstanceCount value.
*/
public Integer maxInstanceCount() {
return this.maxInstanceCount;
}
/**
* Set the maxInstanceCount property: The maximum instance count of the cluster.
*
* @param maxInstanceCount the maxInstanceCount value to set.
* @return the AutoscaleTimeAndCapacity object itself.
*/
public AutoscaleTimeAndCapacity withMaxInstanceCount(Integer maxInstanceCount) {
this.maxInstanceCount = maxInstanceCount;
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("time", this.time);
jsonWriter.writeNumberField("minInstanceCount", this.minInstanceCount);
jsonWriter.writeNumberField("maxInstanceCount", this.maxInstanceCount);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AutoscaleTimeAndCapacity from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AutoscaleTimeAndCapacity 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 AutoscaleTimeAndCapacity.
*/
public static AutoscaleTimeAndCapacity fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AutoscaleTimeAndCapacity deserializedAutoscaleTimeAndCapacity = new AutoscaleTimeAndCapacity();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("time".equals(fieldName)) {
deserializedAutoscaleTimeAndCapacity.time = reader.getString();
} else if ("minInstanceCount".equals(fieldName)) {
deserializedAutoscaleTimeAndCapacity.minInstanceCount = reader.getNullable(JsonReader::getInt);
} else if ("maxInstanceCount".equals(fieldName)) {
deserializedAutoscaleTimeAndCapacity.maxInstanceCount = reader.getNullable(JsonReader::getInt);
} else {
reader.skipChildren();
}
}
return deserializedAutoscaleTimeAndCapacity;
});
}
}