hcl

package
v0.0.0-...-e9f6b3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataSourceGraphite   = "graphite"
	DataSourceInfluxDB   = "influxdb"
	DataSourceInfluxDB08 = "influxdb_08"
	DataSourceElastic    = "elasticsearch"
	DataSourceOpenTSDB   = "opentsdb"
	DataSourceCloudWatch = "cloudwatch"
	DataSourceKairosDB   = "kairosdb"
	DataSourcePrometheus = "prometheus"
	DataSourcePostgres   = "postgres"
	DataSourceMySQL      = "mysql"

	DataSourceAccessDirect = "direct"
	DataSourceAccessProxy  = "proxy"
)

Variables

View Source
var (
	ErrDataSourceNotFound      = errors.New("Data source type not found")
	ErrDataSourceAccessInvalid = errors.New("Data source access invalid")
)

Functions

func Output

func Output(r Resource) (string, error)

func Validate

func Validate(r Resource) error

Types

type AxisGraphPanelConfig

type AxisGraphPanelConfig struct {
	Format  string          `hcl:"format"`
	LogBase int             `hcl:"logBase"`
	Max     IntStringConfig `hcl:"max"`
	Min     IntStringConfig `hcl:"min"`
	Show    bool            `hcl:"show"`
}

type BoolStringConfig

type BoolStringConfig struct {
	Flag  bool   `hcl:"flag"`
	Value string `hcl:"value"`
}

type BucketAggsTargetPanelConfig

type BucketAggsTargetPanelConfig struct {
	Field    string `hcl:"field"`
	Type     string `hcl:"type"`
	Settings struct {
		Interval    string `hcl:"interval"`
		MinDocCount int    `hcl:"min_doc_count"`
	} `hcl:"settings"`
}

type Config

type Config struct {
	DataSources []DataSourceConfig `hcl:"data_source"`
	GraphPanels []GraphPanelConfig `hcl:"graph_panel"`
}

func ParseConfig

func ParseConfig(hclText string) (*Config, error)

type CustomPanelConfig

type CustomPanelConfig struct {
}

type DashListPanelConfig

type DashListPanelConfig struct {
}

type DataSourceBasicAuthConfig

type DataSourceBasicAuthConfig struct {
	User     string `hcl:"user"`
	Password string `hcl:"password"`
}

type DataSourceConfig

type DataSourceConfig struct {
	Name      string `hcl:",key"`
	Type      string `hcl:"type"`
	Access    string `hcl:"access"`
	URL       string `hcl:"url"`
	Database  string `hcl:"database"`
	User      string `hcl:"user"`
	Password  string `hcl:"password"`
	IsDefault bool   `hcl:"is_default"`

	JSONData  string                    `hcl:"json_data"`
	BasicAuth DataSourceBasicAuthConfig `hcl:"basic_auth"`
}

func (*DataSourceConfig) GenerateJSON

func (d *DataSourceConfig) GenerateJSON() ([]byte, error)

func (*DataSourceConfig) ValidateHCL

func (d *DataSourceConfig) ValidateHCL() error

type GraphPanelConfig

type GraphPanelConfig struct {
	Name            string                           `hcl:",key"`
	AliasColors     interface{}                      `hcl:"alias_colors"`
	Bars            bool                             `hcl:"bars"`
	Fill            int                              `hcl:"fill"`
	Legend          LegendGraphPanelConfig           `hcl:"legend"`
	LeftYAxisLabel  string                           `hcl:"left_y_axis_label"`
	RightYAxisLabel string                           `hcl:"righty_axis_label"`
	Lines           bool                             `hcl:"lines"`
	Linewidth       uint                             `hcl:"line_width"`
	NullPointMode   string                           `hcl:"null_point_mode"`
	Percentage      bool                             `hcl:"percentage"`
	Pointradius     int                              `hcl:"point_radius"`
	Points          bool                             `hcl:"points"`
	SeriesOverrides []SeriesOverrideGraphPanelConfig `hcl:"series_overrides"`
	Stack           bool                             `hcl:"stack"`
	SteppedLine     bool                             `hcl:"stepped_line"`
	Targets         []TargetPanelConfig              `hcl:"targets"`
	TimeFrom        string                           `hcl:"time_from"`
	TimeShift       string                           `hcl:"time_shift"`
	Tooltip         TooltipConfig                    `hcl:"tooltip"`
	XAxis           bool                             `hcl:"x_axis"`
	YAxis           bool                             `hcl:"y_axis"`
	YFormats        []string                         `hcl:"y_formats"`
	Xaxes           AxisGraphPanelConfig             `hcl:"x_axe"`
	Yaxes           []AxisGraphPanelConfig           `hcl:"y_axes"`
	Decimals        int                              `hcl:"decimals"`
}

func (*GraphPanelConfig) GenerateJSON

func (g *GraphPanelConfig) GenerateJSON() ([]byte, error)

func (*GraphPanelConfig) ValidateHCL

func (g *GraphPanelConfig) ValidateHCL() error

type IntStringConfig

type IntStringConfig struct {
	Value int64 `hcl:"value"`
	Valid bool  `hcl:"valid"`
}

type LegendGraphPanelConfig

type LegendGraphPanelConfig struct {
	AlignAsTable bool `hcl:"align_as_table"`
	Avg          bool `hcl:"show_average"`
	Current      bool `hcl:"show_current"`
	HideEmpty    bool `hcl:"hide_empty"`
	HideZero     bool `hcl:"hide_zero"`
	Max          bool `hcl:"show_max"`
	Min          bool `hcl:"show_min"`
	RightSide    bool `hcl:"right_side"`
	Show         bool `hcl:"show"`
	Total        bool `hcl:"show_total"`
	Values       bool `hcl:"values"`
	SideWidth    int  `hcl:"right_side_width"`
}

type MetricsTargetPanelConfig

type MetricsTargetPanelConfig struct {
	Field string `hcl:"field"`
	Type  string `hcl:"type"`
}

type Panel

type Panel interface {
}

type PluginListPanelConfig

type PluginListPanelConfig struct {
}

type Resource

type Resource interface {
	ValidateHCL() error
	GenerateJSON() ([]byte, error)
}

type RowConfig

type RowConfig struct {
	Name      string  `hcl:",key"`
	Title     string  `hcl:"title"`
	ShowTitle bool    `hcl:"show_title"`
	Collapse  bool    `hcl:"collapse"`
	Editable  bool    `hcl:"editable"`
	Height    int     `hcl:"height"`
	Panels    []Panel `hcl:"panels"`
}

func (*RowConfig) GenerateJSON

func (d *RowConfig) GenerateJSON() ([]byte, error)

func (*RowConfig) ValidateHCL

func (d *RowConfig) ValidateHCL() error

type SeriesOverrideGraphPanelConfig

type SeriesOverrideGraphPanelConfig struct {
	Alias         string           `hcl:"alias"`
	Bars          bool             `hcl:"bars"`
	Color         string           `hcl:"color"`
	Fill          int              `hcl:"fill"`
	FillBelowTo   string           `hcl:"fill_below_to"`
	Legend        bool             `hcl:"legend"`
	Lines         bool             `hcl:"lines"`
	Stack         BoolStringConfig `hcl:"stack"`
	Transform     string           `hcl:"transform"`
	YAxis         int              `hcl:"y_axis"`
	ZIndex        int              `hcl:"z_index"`
	NullPointMode string           `hcl:"null_point_mode"`
}

type SingleStatPanelConfig

type SingleStatPanelConfig struct {
}

type SortTablePanelConfig

type SortTablePanelConfig struct {
	Col  uint `hcl:"col"`
	Desc bool `hcl:"desc"`
}

type TablePanelConfig

type TablePanelConfig struct {
	Columns   map[string]interface{} `hcl:"columns"`
	Sort      SortTablePanelConfig   `hcl:"sort"`
	Styles    map[string]interface{} `hcl:"styles"`
	Transform string                 `hcl:"transform"`
	Targets   []TargetPanelConfig    `hcl:"targets"`
	Scroll    bool                   `hcl:"scroll"`
}

type TargetPanelConfig

type TargetPanelConfig struct {
	Name       string `hcl:", key"`
	Datasource string `hcl:"datasource"`

	Expr           string `hcl:"expr"`
	IntervalFactor int    `hcl:"interval_factor"`
	Interval       string `hcl:"interval"`
	Step           int    `hcl:"step"`
	LegendFormat   string `hcl:"legend_format"`

	DsType     string                        `hcl:"ds_type"`
	Metrics    []MetricsTargetPanelConfig    `hcl:"metrics"`
	Query      string                        `hcl:"query"`
	Alias      string                        `hcl:"alias"`
	RawQuery   bool                          `hcl:"raw_query"`
	TimeField  string                        `hcl:"time_field"`
	BucketAggs []BucketAggsTargetPanelConfig `hcl:"bucket_aggs"`

	Target string `hcl:"target"`
}

type TextPanelConfig

type TextPanelConfig struct {
}

type TooltipConfig

type TooltipConfig struct {
	Shared       bool   `hcl:"shared"`
	ValueType    string `hcl:"value_type"`
	MsResolution bool   `hcl:"ms_resolution"`
	Sort         int    `hcl:"sort"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL