com.grafana.foundation.dashboard.TimePickerConfig 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.dashboard;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
// Time picker configuration
// It defines the default config for the time picker and the refresh picker for the specific dashboard.
public class TimePickerConfig {
// Whether timepicker is visible or not.
@JsonProperty("hidden")
public Boolean hidden;
// Interval options available in the refresh picker dropdown.
@JsonProperty("refresh_intervals")
public List refreshIntervals;
// Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
@JsonProperty("time_options")
public List timeOptions;
// Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.
@JsonProperty("nowDelay")
public String nowDelay;
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 {
private final TimePickerConfig internal;
public Builder() {
this.internal = new TimePickerConfig();
this.hidden(false);
this.refreshIntervals(List.of("5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"));
this.timeOptions(List.of("5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"));
}
public Builder hidden(Boolean hidden) {
this.internal.hidden = hidden;
return this;
}
public Builder refreshIntervals(List refreshIntervals) {
this.internal.refreshIntervals = refreshIntervals;
return this;
}
public Builder timeOptions(List timeOptions) {
this.internal.timeOptions = timeOptions;
return this;
}
public Builder nowDelay(String nowDelay) {
this.internal.nowDelay = nowDelay;
return this;
}
public TimePickerConfig build() {
return this.internal;
}
}
}