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

com.azure.ai.metricsadvisor.implementation.models.SeverityCondition 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 SeverityCondition model.
 */
@Fluent
public final class SeverityCondition implements JsonSerializable {
    /*
     * min alert severity
     */
    private Severity minAlertSeverity;

    /*
     * max alert severity
     */
    private Severity maxAlertSeverity;

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

    /**
     * Get the minAlertSeverity property: min alert severity.
     * 
     * @return the minAlertSeverity value.
     */
    public Severity getMinAlertSeverity() {
        return this.minAlertSeverity;
    }

    /**
     * Set the minAlertSeverity property: min alert severity.
     * 
     * @param minAlertSeverity the minAlertSeverity value to set.
     * @return the SeverityCondition object itself.
     */
    public SeverityCondition setMinAlertSeverity(Severity minAlertSeverity) {
        this.minAlertSeverity = minAlertSeverity;
        return this;
    }

    /**
     * Get the maxAlertSeverity property: max alert severity.
     * 
     * @return the maxAlertSeverity value.
     */
    public Severity getMaxAlertSeverity() {
        return this.maxAlertSeverity;
    }

    /**
     * Set the maxAlertSeverity property: max alert severity.
     * 
     * @param maxAlertSeverity the maxAlertSeverity value to set.
     * @return the SeverityCondition object itself.
     */
    public SeverityCondition setMaxAlertSeverity(Severity maxAlertSeverity) {
        this.maxAlertSeverity = maxAlertSeverity;
        return this;
    }

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

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

                if ("minAlertSeverity".equals(fieldName)) {
                    deserializedSeverityCondition.minAlertSeverity = Severity.fromString(reader.getString());
                } else if ("maxAlertSeverity".equals(fieldName)) {
                    deserializedSeverityCondition.maxAlertSeverity = Severity.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSeverityCondition;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy