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

com.azure.ai.metricsadvisor.implementation.models.AnomalyDetectionConfiguration 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 AnomalyDetectionConfiguration model.
 */
@Fluent
public final class AnomalyDetectionConfiguration implements JsonSerializable {
    /*
     * anomaly detection configuration unique id
     */
    private UUID anomalyDetectionConfigurationId;

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

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

    /*
     * metric unique id
     */
    private UUID metricId;

    /*
     * The wholeMetricConfiguration property.
     */
    private WholeMetricConfiguration wholeMetricConfiguration;

    /*
     * detection configuration for series group
     */
    private List dimensionGroupOverrideConfigurations;

    /*
     * detection configuration for specific series
     */
    private List seriesOverrideConfigurations;

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

    /**
     * Get the anomalyDetectionConfigurationId property: anomaly detection configuration unique id.
     * 
     * @return the anomalyDetectionConfigurationId value.
     */
    public UUID getAnomalyDetectionConfigurationId() {
        return this.anomalyDetectionConfigurationId;
    }

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

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

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

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

    /**
     * Get the metricId property: metric unique id.
     * 
     * @return the metricId value.
     */
    public UUID getMetricId() {
        return this.metricId;
    }

    /**
     * Set the metricId property: metric unique id.
     * 
     * @param metricId the metricId value to set.
     * @return the AnomalyDetectionConfiguration object itself.
     */
    public AnomalyDetectionConfiguration setMetricId(UUID metricId) {
        this.metricId = metricId;
        return this;
    }

    /**
     * Get the wholeMetricConfiguration property: The wholeMetricConfiguration property.
     * 
     * @return the wholeMetricConfiguration value.
     */
    public WholeMetricConfiguration getWholeMetricConfiguration() {
        return this.wholeMetricConfiguration;
    }

    /**
     * Set the wholeMetricConfiguration property: The wholeMetricConfiguration property.
     * 
     * @param wholeMetricConfiguration the wholeMetricConfiguration value to set.
     * @return the AnomalyDetectionConfiguration object itself.
     */
    public AnomalyDetectionConfiguration
        setWholeMetricConfiguration(WholeMetricConfiguration wholeMetricConfiguration) {
        this.wholeMetricConfiguration = wholeMetricConfiguration;
        return this;
    }

    /**
     * Get the dimensionGroupOverrideConfigurations property: detection configuration for series group.
     * 
     * @return the dimensionGroupOverrideConfigurations value.
     */
    public List getDimensionGroupOverrideConfigurations() {
        return this.dimensionGroupOverrideConfigurations;
    }

    /**
     * Set the dimensionGroupOverrideConfigurations property: detection configuration for series group.
     * 
     * @param dimensionGroupOverrideConfigurations the dimensionGroupOverrideConfigurations value to set.
     * @return the AnomalyDetectionConfiguration object itself.
     */
    public AnomalyDetectionConfiguration setDimensionGroupOverrideConfigurations(
        List dimensionGroupOverrideConfigurations) {
        this.dimensionGroupOverrideConfigurations = dimensionGroupOverrideConfigurations;
        return this;
    }

    /**
     * Get the seriesOverrideConfigurations property: detection configuration for specific series.
     * 
     * @return the seriesOverrideConfigurations value.
     */
    public List getSeriesOverrideConfigurations() {
        return this.seriesOverrideConfigurations;
    }

    /**
     * Set the seriesOverrideConfigurations property: detection configuration for specific series.
     * 
     * @param seriesOverrideConfigurations the seriesOverrideConfigurations value to set.
     * @return the AnomalyDetectionConfiguration object itself.
     */
    public AnomalyDetectionConfiguration
        setSeriesOverrideConfigurations(List seriesOverrideConfigurations) {
        this.seriesOverrideConfigurations = seriesOverrideConfigurations;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("name", this.name);
        jsonWriter.writeStringField("metricId", Objects.toString(this.metricId, null));
        jsonWriter.writeJsonField("wholeMetricConfiguration", this.wholeMetricConfiguration);
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeArrayField("dimensionGroupOverrideConfigurations", this.dimensionGroupOverrideConfigurations,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeArrayField("seriesOverrideConfigurations", this.seriesOverrideConfigurations,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedAnomalyDetectionConfiguration.name = reader.getString();
                } else if ("metricId".equals(fieldName)) {
                    deserializedAnomalyDetectionConfiguration.metricId
                        = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
                } else if ("wholeMetricConfiguration".equals(fieldName)) {
                    deserializedAnomalyDetectionConfiguration.wholeMetricConfiguration
                        = WholeMetricConfiguration.fromJson(reader);
                } else if ("anomalyDetectionConfigurationId".equals(fieldName)) {
                    deserializedAnomalyDetectionConfiguration.anomalyDetectionConfigurationId
                        = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
                } else if ("description".equals(fieldName)) {
                    deserializedAnomalyDetectionConfiguration.description = reader.getString();
                } else if ("dimensionGroupOverrideConfigurations".equals(fieldName)) {
                    List dimensionGroupOverrideConfigurations
                        = reader.readArray(reader1 -> DimensionGroupConfiguration.fromJson(reader1));
                    deserializedAnomalyDetectionConfiguration.dimensionGroupOverrideConfigurations
                        = dimensionGroupOverrideConfigurations;
                } else if ("seriesOverrideConfigurations".equals(fieldName)) {
                    List seriesOverrideConfigurations
                        = reader.readArray(reader1 -> SeriesConfiguration.fromJson(reader1));
                    deserializedAnomalyDetectionConfiguration.seriesOverrideConfigurations
                        = seriesOverrideConfigurations;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAnomalyDetectionConfiguration;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy