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

com.azure.ai.metricsadvisor.implementation.models.RootCause Maven / Gradle / Ivy

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.ai.metricsadvisor.implementation.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;
import java.util.List;

/**
 * The RootCause model.
 */
@Fluent
public final class RootCause implements JsonSerializable {
    /*
     * The rootCause property.
     */
    private DimensionGroupIdentity rootCause;

    /*
     * drilling down path from query anomaly to root cause
     */
    private List path;

    /*
     * score of the root cause
     */
    private double score;

    /*
     * description of the root cause
     */
    private String description;

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

    /**
     * Get the rootCause property: The rootCause property.
     * 
     * @return the rootCause value.
     */
    public DimensionGroupIdentity getRootCause() {
        return this.rootCause;
    }

    /**
     * Set the rootCause property: The rootCause property.
     * 
     * @param rootCause the rootCause value to set.
     * @return the RootCause object itself.
     */
    public RootCause setRootCause(DimensionGroupIdentity rootCause) {
        this.rootCause = rootCause;
        return this;
    }

    /**
     * Get the path property: drilling down path from query anomaly to root cause.
     * 
     * @return the path value.
     */
    public List getPath() {
        return this.path;
    }

    /**
     * Set the path property: drilling down path from query anomaly to root cause.
     * 
     * @param path the path value to set.
     * @return the RootCause object itself.
     */
    public RootCause setPath(List path) {
        this.path = path;
        return this;
    }

    /**
     * Get the score property: score of the root cause.
     * 
     * @return the score value.
     */
    public double getScore() {
        return this.score;
    }

    /**
     * Set the score property: score of the root cause.
     * 
     * @param score the score value to set.
     * @return the RootCause object itself.
     */
    public RootCause setScore(double score) {
        this.score = score;
        return this;
    }

    /**
     * Get the description property: description of the root cause.
     * 
     * @return the description value.
     */
    public String getDescription() {
        return this.description;
    }

    /**
     * Set the description property: description of the root cause.
     * 
     * @param description the description value to set.
     * @return the RootCause object itself.
     */
    public RootCause setDescription(String description) {
        this.description = description;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("rootCause", this.rootCause);
        jsonWriter.writeArrayField("path", this.path, (writer, element) -> writer.writeString(element));
        jsonWriter.writeDoubleField("score", this.score);
        jsonWriter.writeStringField("description", this.description);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of RootCause from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of RootCause if the JsonReader was pointing to an instance of it, or null if it was pointing
     * to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the RootCause.
     */
    public static RootCause fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            RootCause deserializedRootCause = new RootCause();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("rootCause".equals(fieldName)) {
                    deserializedRootCause.rootCause = DimensionGroupIdentity.fromJson(reader);
                } else if ("path".equals(fieldName)) {
                    List path = reader.readArray(reader1 -> reader1.getString());
                    deserializedRootCause.path = path;
                } else if ("score".equals(fieldName)) {
                    deserializedRootCause.score = reader.getDouble();
                } else if ("description".equals(fieldName)) {
                    deserializedRootCause.description = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRootCause;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy