All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.hdinsight.models.AutoscaleCapacity Maven / Gradle / Ivy

Go to download

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;

/**
 * The load-based autoscale request parameters.
 */
@Fluent
public final class AutoscaleCapacity implements JsonSerializable {
    /*
     * The minimum instance count of the cluster
     */
    private Integer minInstanceCount;

    /*
     * The maximum instance count of the cluster
     */
    private Integer maxInstanceCount;

    /**
     * Creates an instance of AutoscaleCapacity class.
     */
    public AutoscaleCapacity() {
    }

    /**
     * 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 AutoscaleCapacity object itself.
     */
    public AutoscaleCapacity 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 AutoscaleCapacity object itself.
     */
    public AutoscaleCapacity 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.writeNumberField("minInstanceCount", this.minInstanceCount);
        jsonWriter.writeNumberField("maxInstanceCount", this.maxInstanceCount);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of AutoscaleCapacity from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of AutoscaleCapacity 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 AutoscaleCapacity.
     */
    public static AutoscaleCapacity fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            AutoscaleCapacity deserializedAutoscaleCapacity = new AutoscaleCapacity();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("minInstanceCount".equals(fieldName)) {
                    deserializedAutoscaleCapacity.minInstanceCount = reader.getNullable(JsonReader::getInt);
                } else if ("maxInstanceCount".equals(fieldName)) {
                    deserializedAutoscaleCapacity.maxInstanceCount = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAutoscaleCapacity;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy