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

com.azure.resourcemanager.sql.models.AutomaticTuningServerOptions Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Sql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

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.sql.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;

/**
 * Automatic tuning properties for individual advisors.
 */
@Fluent
public final class AutomaticTuningServerOptions implements JsonSerializable {
    /*
     * Automatic tuning option desired state.
     */
    private AutomaticTuningOptionModeDesired desiredState;

    /*
     * Automatic tuning option actual state.
     */
    private AutomaticTuningOptionModeActual actualState;

    /*
     * Reason code if desired and actual state are different.
     */
    private Integer reasonCode;

    /*
     * Reason description if desired and actual state are different.
     */
    private AutomaticTuningServerReason reasonDesc;

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

    /**
     * Get the desiredState property: Automatic tuning option desired state.
     * 
     * @return the desiredState value.
     */
    public AutomaticTuningOptionModeDesired desiredState() {
        return this.desiredState;
    }

    /**
     * Set the desiredState property: Automatic tuning option desired state.
     * 
     * @param desiredState the desiredState value to set.
     * @return the AutomaticTuningServerOptions object itself.
     */
    public AutomaticTuningServerOptions withDesiredState(AutomaticTuningOptionModeDesired desiredState) {
        this.desiredState = desiredState;
        return this;
    }

    /**
     * Get the actualState property: Automatic tuning option actual state.
     * 
     * @return the actualState value.
     */
    public AutomaticTuningOptionModeActual actualState() {
        return this.actualState;
    }

    /**
     * Get the reasonCode property: Reason code if desired and actual state are different.
     * 
     * @return the reasonCode value.
     */
    public Integer reasonCode() {
        return this.reasonCode;
    }

    /**
     * Get the reasonDesc property: Reason description if desired and actual state are different.
     * 
     * @return the reasonDesc value.
     */
    public AutomaticTuningServerReason reasonDesc() {
        return this.reasonDesc;
    }

    /**
     * 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("desiredState", this.desiredState == null ? null : this.desiredState.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("desiredState".equals(fieldName)) {
                    deserializedAutomaticTuningServerOptions.desiredState
                        = AutomaticTuningOptionModeDesired.fromString(reader.getString());
                } else if ("actualState".equals(fieldName)) {
                    deserializedAutomaticTuningServerOptions.actualState
                        = AutomaticTuningOptionModeActual.fromString(reader.getString());
                } else if ("reasonCode".equals(fieldName)) {
                    deserializedAutomaticTuningServerOptions.reasonCode = reader.getNullable(JsonReader::getInt);
                } else if ("reasonDesc".equals(fieldName)) {
                    deserializedAutomaticTuningServerOptions.reasonDesc
                        = AutomaticTuningServerReason.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAutomaticTuningServerOptions;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy