com.grafana.foundation.elasticsearch.PipelineMetricAggregation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grafana-foundation-sdk Show documentation
Show all versions of grafana-foundation-sdk Show documentation
A set of tools, types and libraries for building and manipulating Grafana objects.
// 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.databind.annotation.JsonSerialize;
@JsonDeserialize(using = PipelineMetricAggregationDeserializer.class)
public class PipelineMetricAggregation {
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonUnwrapped
protected MovingAverage movingAverage;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonUnwrapped
protected Derivative derivative;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonUnwrapped
protected CumulativeSum cumulativeSum;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonUnwrapped
protected BucketScript bucketScript;
protected PipelineMetricAggregation() {}
public static PipelineMetricAggregation createMovingAverage(com.grafana.foundation.cog.Builder movingAverage) {
PipelineMetricAggregation pipelineMetricAggregation = new PipelineMetricAggregation();
pipelineMetricAggregation.movingAverage = movingAverage.build();
return pipelineMetricAggregation;
}
public static PipelineMetricAggregation createDerivative(com.grafana.foundation.cog.Builder derivative) {
PipelineMetricAggregation pipelineMetricAggregation = new PipelineMetricAggregation();
pipelineMetricAggregation.derivative = derivative.build();
return pipelineMetricAggregation;
}
public static PipelineMetricAggregation createCumulativeSum(com.grafana.foundation.cog.Builder cumulativeSum) {
PipelineMetricAggregation pipelineMetricAggregation = new PipelineMetricAggregation();
pipelineMetricAggregation.cumulativeSum = cumulativeSum.build();
return pipelineMetricAggregation;
}
public static PipelineMetricAggregation createBucketScript(com.grafana.foundation.cog.Builder bucketScript) {
PipelineMetricAggregation pipelineMetricAggregation = new PipelineMetricAggregation();
pipelineMetricAggregation.bucketScript = bucketScript.build();
return pipelineMetricAggregation;
}
public String toJSON() throws JsonProcessingException {
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);
}
return null;
}
}