com.grafana.foundation.googlecloudmonitoring.MetricQuery 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.googlecloudmonitoring;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
// @deprecated This type is for migration purposes only. Replaced by TimeSeriesList Metric sub-query properties.
public class MetricQuery {
// GCP project to execute the query against.
@JsonProperty("projectName")
public String projectName;
// Alignment function to be used. Defaults to ALIGN_MEAN.
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("perSeriesAligner")
public String perSeriesAligner;
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("alignmentPeriod")
public String alignmentPeriod;
// Aliases can be set to modify the legend labels. e.g. {{metric.label.xxx}}. See docs for more detail.
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("aliasBy")
public String aliasBy;
@JsonProperty("editorMode")
public String editorMode;
@JsonProperty("metricType")
public String metricType;
// Reducer applied across a set of time-series values. Defaults to REDUCE_NONE.
@JsonProperty("crossSeriesReducer")
public String crossSeriesReducer;
// Array of labels to group data by.
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("groupBys")
public List groupBys;
// Array of filters to query data by. Labels that can be filtered on are defined by the metric.
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("filters")
public List filters;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("metricKind")
public MetricKind metricKind;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("valueType")
public String valueType;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("view")
public String view;
// MQL query to be executed.
@JsonProperty("query")
public String query;
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("preprocessor")
public PreprocessorType preprocessor;
// To disable the graphPeriod, it should explictly be set to 'disabled'.
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("graphPeriod")
public String graphPeriod;
public String toJSON() throws JsonProcessingException {
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
return ow.writeValueAsString(this);
}
public static class Builder implements com.grafana.foundation.cog.Builder {
protected final MetricQuery internal;
public Builder() {
this.internal = new MetricQuery();
this.graphPeriod("disabled");
}
public Builder projectName(String projectName) {
this.internal.projectName = projectName;
return this;
}
public Builder perSeriesAligner(String perSeriesAligner) {
this.internal.perSeriesAligner = perSeriesAligner;
return this;
}
public Builder alignmentPeriod(String alignmentPeriod) {
this.internal.alignmentPeriod = alignmentPeriod;
return this;
}
public Builder aliasBy(String aliasBy) {
this.internal.aliasBy = aliasBy;
return this;
}
public Builder editorMode(String editorMode) {
this.internal.editorMode = editorMode;
return this;
}
public Builder metricType(String metricType) {
this.internal.metricType = metricType;
return this;
}
public Builder crossSeriesReducer(String crossSeriesReducer) {
this.internal.crossSeriesReducer = crossSeriesReducer;
return this;
}
public Builder groupBys(List groupBys) {
this.internal.groupBys = groupBys;
return this;
}
public Builder filters(List filters) {
this.internal.filters = filters;
return this;
}
public Builder metricKind(MetricKind metricKind) {
this.internal.metricKind = metricKind;
return this;
}
public Builder valueType(String valueType) {
this.internal.valueType = valueType;
return this;
}
public Builder view(String view) {
this.internal.view = view;
return this;
}
public Builder query(String query) {
this.internal.query = query;
return this;
}
public Builder preprocessor(PreprocessorType preprocessor) {
this.internal.preprocessor = preprocessor;
return this;
}
public Builder graphPeriod(String graphPeriod) {
this.internal.graphPeriod = graphPeriod;
return this;
}
public MetricQuery build() {
return this.internal;
}
}
}