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

com.azure.ai.metricsadvisor.implementation.models.AnomalyAlertingConfiguration 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;
import java.util.Objects;
import java.util.UUID;

/**
 * The AnomalyAlertingConfiguration model.
 */
@Fluent
public final class AnomalyAlertingConfiguration implements JsonSerializable {
    /*
     * anomaly alerting configuration unique id
     */
    private UUID anomalyAlertingConfigurationId;

    /*
     * anomaly alerting configuration name
     */
    private String name;

    /*
     * anomaly alerting configuration description
     */
    private String description;

    /*
     * cross metrics operator
     * 
     * should be specified when setting up multiple metric alerting configurations
     */
    private AnomalyAlertingConfigurationLogicType crossMetricsOperator;

    /*
     * dimensions used to split alert
     */
    private List splitAlertByDimensions;

    /*
     * hook unique ids
     */
    private List hookIds;

    /*
     * Anomaly alerting configurations
     */
    private List metricAlertingConfigurations;

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

    /**
     * Get the anomalyAlertingConfigurationId property: anomaly alerting configuration unique id.
     * 
     * @return the anomalyAlertingConfigurationId value.
     */
    public UUID getAnomalyAlertingConfigurationId() {
        return this.anomalyAlertingConfigurationId;
    }

    /**
     * Get the name property: anomaly alerting configuration name.
     * 
     * @return the name value.
     */
    public String getName() {
        return this.name;
    }

    /**
     * Set the name property: anomaly alerting configuration name.
     * 
     * @param name the name value to set.
     * @return the AnomalyAlertingConfiguration object itself.
     */
    public AnomalyAlertingConfiguration setName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the description property: anomaly alerting configuration description.
     * 
     * @return the description value.
     */
    public String getDescription() {
        return this.description;
    }

    /**
     * Set the description property: anomaly alerting configuration description.
     * 
     * @param description the description value to set.
     * @return the AnomalyAlertingConfiguration object itself.
     */
    public AnomalyAlertingConfiguration setDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the crossMetricsOperator property: cross metrics operator
     * 
     * should be specified when setting up multiple metric alerting configurations.
     * 
     * @return the crossMetricsOperator value.
     */
    public AnomalyAlertingConfigurationLogicType getCrossMetricsOperator() {
        return this.crossMetricsOperator;
    }

    /**
     * Set the crossMetricsOperator property: cross metrics operator
     * 
     * should be specified when setting up multiple metric alerting configurations.
     * 
     * @param crossMetricsOperator the crossMetricsOperator value to set.
     * @return the AnomalyAlertingConfiguration object itself.
     */
    public AnomalyAlertingConfiguration
        setCrossMetricsOperator(AnomalyAlertingConfigurationLogicType crossMetricsOperator) {
        this.crossMetricsOperator = crossMetricsOperator;
        return this;
    }

    /**
     * Get the splitAlertByDimensions property: dimensions used to split alert.
     * 
     * @return the splitAlertByDimensions value.
     */
    public List getSplitAlertByDimensions() {
        return this.splitAlertByDimensions;
    }

    /**
     * Set the splitAlertByDimensions property: dimensions used to split alert.
     * 
     * @param splitAlertByDimensions the splitAlertByDimensions value to set.
     * @return the AnomalyAlertingConfiguration object itself.
     */
    public AnomalyAlertingConfiguration setSplitAlertByDimensions(List splitAlertByDimensions) {
        this.splitAlertByDimensions = splitAlertByDimensions;
        return this;
    }

    /**
     * Get the hookIds property: hook unique ids.
     * 
     * @return the hookIds value.
     */
    public List getHookIds() {
        return this.hookIds;
    }

    /**
     * Set the hookIds property: hook unique ids.
     * 
     * @param hookIds the hookIds value to set.
     * @return the AnomalyAlertingConfiguration object itself.
     */
    public AnomalyAlertingConfiguration setHookIds(List hookIds) {
        this.hookIds = hookIds;
        return this;
    }

    /**
     * Get the metricAlertingConfigurations property: Anomaly alerting configurations.
     * 
     * @return the metricAlertingConfigurations value.
     */
    public List getMetricAlertingConfigurations() {
        return this.metricAlertingConfigurations;
    }

    /**
     * Set the metricAlertingConfigurations property: Anomaly alerting configurations.
     * 
     * @param metricAlertingConfigurations the metricAlertingConfigurations value to set.
     * @return the AnomalyAlertingConfiguration object itself.
     */
    public AnomalyAlertingConfiguration
        setMetricAlertingConfigurations(List metricAlertingConfigurations) {
        this.metricAlertingConfigurations = metricAlertingConfigurations;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("name", this.name);
        jsonWriter.writeArrayField("hookIds", this.hookIds,
            (writer, element) -> writer.writeString(Objects.toString(element, null)));
        jsonWriter.writeArrayField("metricAlertingConfigurations", this.metricAlertingConfigurations,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeStringField("crossMetricsOperator",
            this.crossMetricsOperator == null ? null : this.crossMetricsOperator.toString());
        jsonWriter.writeArrayField("splitAlertByDimensions", this.splitAlertByDimensions,
            (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedAnomalyAlertingConfiguration.name = reader.getString();
                } else if ("hookIds".equals(fieldName)) {
                    List hookIds = reader.readArray(
                        reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())));
                    deserializedAnomalyAlertingConfiguration.hookIds = hookIds;
                } else if ("metricAlertingConfigurations".equals(fieldName)) {
                    List metricAlertingConfigurations
                        = reader.readArray(reader1 -> MetricAlertingConfiguration.fromJson(reader1));
                    deserializedAnomalyAlertingConfiguration.metricAlertingConfigurations
                        = metricAlertingConfigurations;
                } else if ("anomalyAlertingConfigurationId".equals(fieldName)) {
                    deserializedAnomalyAlertingConfiguration.anomalyAlertingConfigurationId
                        = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
                } else if ("description".equals(fieldName)) {
                    deserializedAnomalyAlertingConfiguration.description = reader.getString();
                } else if ("crossMetricsOperator".equals(fieldName)) {
                    deserializedAnomalyAlertingConfiguration.crossMetricsOperator
                        = AnomalyAlertingConfigurationLogicType.fromString(reader.getString());
                } else if ("splitAlertByDimensions".equals(fieldName)) {
                    List splitAlertByDimensions = reader.readArray(reader1 -> reader1.getString());
                    deserializedAnomalyAlertingConfiguration.splitAlertByDimensions = splitAlertByDimensions;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAnomalyAlertingConfiguration;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy