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

com.grafana.foundation.elasticsearch.MetricAggregation Maven / Gradle / Ivy

There is a newer version: 11.3.0-1730898216
Show newest version
// Code generated - EDITING IS FUTILE. DO NOT EDIT.

package com.grafana.foundation.elasticsearch;

import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.annotation.JsonInclude;

@JsonDeserialize(using = MetricAggregationDeserializer.class)
public class MetricAggregation {
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected Count count;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected MovingAverage movingAverage;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected Derivative derivative;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected CumulativeSum cumulativeSum;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected BucketScript bucketScript;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected SerialDiff serialDiff;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected RawData rawData;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected RawDocument rawDocument;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected UniqueCount uniqueCount;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected Percentiles percentiles;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected ExtendedStats extendedStats;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected Min min;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected Max max;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected Sum sum;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected Average average;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected MovingFunction movingFunction;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected Logs logs;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected Rate rate;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonUnwrapped
    protected TopMetrics topMetrics;
    protected MetricAggregation() {}
    public static MetricAggregation createCount(com.grafana.foundation.cog.Builder count) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.count = count.build();
        return metricAggregation;
    }
    public static MetricAggregation createMovingAverage(com.grafana.foundation.cog.Builder movingAverage) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.movingAverage = movingAverage.build();
        return metricAggregation;
    }
    public static MetricAggregation createDerivative(com.grafana.foundation.cog.Builder derivative) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.derivative = derivative.build();
        return metricAggregation;
    }
    public static MetricAggregation createCumulativeSum(com.grafana.foundation.cog.Builder cumulativeSum) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.cumulativeSum = cumulativeSum.build();
        return metricAggregation;
    }
    public static MetricAggregation createBucketScript(com.grafana.foundation.cog.Builder bucketScript) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.bucketScript = bucketScript.build();
        return metricAggregation;
    }
    public static MetricAggregation createSerialDiff(com.grafana.foundation.cog.Builder serialDiff) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.serialDiff = serialDiff.build();
        return metricAggregation;
    }
    public static MetricAggregation createRawData(com.grafana.foundation.cog.Builder rawData) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.rawData = rawData.build();
        return metricAggregation;
    }
    public static MetricAggregation createRawDocument(com.grafana.foundation.cog.Builder rawDocument) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.rawDocument = rawDocument.build();
        return metricAggregation;
    }
    public static MetricAggregation createUniqueCount(com.grafana.foundation.cog.Builder uniqueCount) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.uniqueCount = uniqueCount.build();
        return metricAggregation;
    }
    public static MetricAggregation createPercentiles(com.grafana.foundation.cog.Builder percentiles) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.percentiles = percentiles.build();
        return metricAggregation;
    }
    public static MetricAggregation createExtendedStats(com.grafana.foundation.cog.Builder extendedStats) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.extendedStats = extendedStats.build();
        return metricAggregation;
    }
    public static MetricAggregation createMin(com.grafana.foundation.cog.Builder min) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.min = min.build();
        return metricAggregation;
    }
    public static MetricAggregation createMax(com.grafana.foundation.cog.Builder max) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.max = max.build();
        return metricAggregation;
    }
    public static MetricAggregation createSum(com.grafana.foundation.cog.Builder sum) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.sum = sum.build();
        return metricAggregation;
    }
    public static MetricAggregation createAverage(com.grafana.foundation.cog.Builder average) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.average = average.build();
        return metricAggregation;
    }
    public static MetricAggregation createMovingFunction(com.grafana.foundation.cog.Builder movingFunction) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.movingFunction = movingFunction.build();
        return metricAggregation;
    }
    public static MetricAggregation createLogs(com.grafana.foundation.cog.Builder logs) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.logs = logs.build();
        return metricAggregation;
    }
    public static MetricAggregation createRate(com.grafana.foundation.cog.Builder rate) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.rate = rate.build();
        return metricAggregation;
    }
    public static MetricAggregation createTopMetrics(com.grafana.foundation.cog.Builder topMetrics) {
        MetricAggregation metricAggregation = new MetricAggregation();
        metricAggregation.topMetrics = topMetrics.build();
        return metricAggregation;
    }
    
    public String toJSON() throws JsonProcessingException {
        if (count != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(count);
        }
        if (movingAverage != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(movingAverage);
        }
        if (derivative != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(derivative);
        }
        if (cumulativeSum != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(cumulativeSum);
        }
        if (bucketScript != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(bucketScript);
        }
        if (serialDiff != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(serialDiff);
        }
        if (rawData != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(rawData);
        }
        if (rawDocument != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(rawDocument);
        }
        if (uniqueCount != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(uniqueCount);
        }
        if (percentiles != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(percentiles);
        }
        if (extendedStats != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(extendedStats);
        }
        if (min != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(min);
        }
        if (max != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(max);
        }
        if (sum != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(sum);
        }
        if (average != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(average);
        }
        if (movingFunction != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(movingFunction);
        }
        if (logs != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(logs);
        }
        if (rate != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(rate);
        }
        if (topMetrics != null) {
            ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            return ow.writeValueAsString(topMetrics);
        }
        
        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy