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

com.azure.ai.metricsadvisor.implementation.models.IncidentProperty 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;

/**
 * The IncidentProperty model.
 */
@Fluent
public final class IncidentProperty implements JsonSerializable {
    /*
     * max severity of latest anomalies in the incident
     */
    private Severity maxSeverity;

    /*
     * incident status
     * 
     * only return for alerting incident result
     */
    private IncidentStatus incidentStatus;

    /*
     * value of the root node
     */
    private Double valueOfRootNode;

    /*
     * expected value of the root node given by smart detector
     */
    private Double expectedValueOfRootNode;

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

    /**
     * Get the maxSeverity property: max severity of latest anomalies in the incident.
     * 
     * @return the maxSeverity value.
     */
    public Severity getMaxSeverity() {
        return this.maxSeverity;
    }

    /**
     * Set the maxSeverity property: max severity of latest anomalies in the incident.
     * 
     * @param maxSeverity the maxSeverity value to set.
     * @return the IncidentProperty object itself.
     */
    public IncidentProperty setMaxSeverity(Severity maxSeverity) {
        this.maxSeverity = maxSeverity;
        return this;
    }

    /**
     * Get the incidentStatus property: incident status
     * 
     * only return for alerting incident result.
     * 
     * @return the incidentStatus value.
     */
    public IncidentStatus getIncidentStatus() {
        return this.incidentStatus;
    }

    /**
     * Get the valueOfRootNode property: value of the root node.
     * 
     * @return the valueOfRootNode value.
     */
    public Double getValueOfRootNode() {
        return this.valueOfRootNode;
    }

    /**
     * Get the expectedValueOfRootNode property: expected value of the root node given by smart detector.
     * 
     * @return the expectedValueOfRootNode value.
     */
    public Double getExpectedValueOfRootNode() {
        return this.expectedValueOfRootNode;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("maxSeverity", this.maxSeverity == null ? null : this.maxSeverity.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("maxSeverity".equals(fieldName)) {
                    deserializedIncidentProperty.maxSeverity = Severity.fromString(reader.getString());
                } else if ("incidentStatus".equals(fieldName)) {
                    deserializedIncidentProperty.incidentStatus = IncidentStatus.fromString(reader.getString());
                } else if ("valueOfRootNode".equals(fieldName)) {
                    deserializedIncidentProperty.valueOfRootNode = reader.getNullable(JsonReader::getDouble);
                } else if ("expectedValueOfRootNode".equals(fieldName)) {
                    deserializedIncidentProperty.expectedValueOfRootNode = reader.getNullable(JsonReader::getDouble);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIncidentProperty;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy