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

com.grafana.foundation.dashboard.AnnotationQuery 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.dashboard;

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.databind.annotation.JsonSerialize;

// TODO docs
// FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
public class AnnotationQuery {
    // Name of annotation.
    @JsonProperty("name")
    public String name;
    // Datasource where the annotations data is
    @JsonProperty("datasource")
    public DataSourceRef datasource;
    // When enabled the annotation query is issued with every dashboard refresh
    @JsonProperty("enable")
    public Boolean enable;
    // Annotation queries can be toggled on or off at the top of the dashboard.
    // When hide is true, the toggle is not shown in the dashboard.
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
    @JsonProperty("hide")
    public Boolean hide;
    // Color to use for the annotation event markers
    @JsonProperty("iconColor")
    public String iconColor;
    // Filters to apply when fetching annotations
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
    @JsonProperty("filter")
    public AnnotationPanelFilter filter;
    // TODO.. this should just be a normal query target
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
    @JsonProperty("target")
    public AnnotationTarget target;
    // TODO -- this should not exist here, it is based on the --grafana-- datasource
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
    @JsonProperty("type")
    public String type;
    // Set to 1 for the standard annotation query all dashboards have by default.
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
    @JsonProperty("builtIn")
    public Double builtIn;
    
    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 AnnotationQuery internal;
        
        public Builder() {
            this.internal = new AnnotationQuery();
        this.enable(true);
        this.hide(false);
        this.builtIn(0.0);
        }
    public Builder name(String name) {
    this.internal.name = name;
        return this;
    }
    
    public Builder datasource(DataSourceRef datasource) {
    this.internal.datasource = datasource;
        return this;
    }
    
    public Builder enable(Boolean enable) {
    this.internal.enable = enable;
        return this;
    }
    
    public Builder hide(Boolean hide) {
    this.internal.hide = hide;
        return this;
    }
    
    public Builder iconColor(String iconColor) {
    this.internal.iconColor = iconColor;
        return this;
    }
    
    public Builder filter(com.grafana.foundation.cog.Builder filter) {
    this.internal.filter = filter.build();
        return this;
    }
    
    public Builder target(com.grafana.foundation.cog.Builder target) {
    this.internal.target = target.build();
        return this;
    }
    
    public Builder type(String type) {
    this.internal.type = type;
        return this;
    }
    
    public Builder builtIn(Double builtIn) {
    this.internal.builtIn = builtIn;
        return this;
    }
    public AnnotationQuery build() {
            return this.internal;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy