model

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvancedQueries

type AdvancedQueries struct {
	Enabled     bool        `json:"enabled"`
	DisplayInfo DisplayInfo `json:"displayInfo"`
	Format      Format      `json:"format"`
	Query       string      `json:"query"`
	ID          int         `json:"id"`
	ParentPanel *Panels     `json:"-"`
}

func NewPromqlQuery

func NewPromqlQuery(query string, parentPanel *Panels, displayInfo DisplayInfo) *AdvancedQueries

func (*AdvancedQueries) Enable

func (q *AdvancedQueries) Enable(val bool) *AdvancedQueries

func (*AdvancedQueries) WithDataFormat

func (q *AdvancedQueries) WithDataFormat(f *Format) *AdvancedQueries

func (*AdvancedQueries) WithDataRateFormat

func (q *AdvancedQueries) WithDataRateFormat(f *Format) *AdvancedQueries

func (*AdvancedQueries) WithNumberFormat

func (q *AdvancedQueries) WithNumberFormat(f *Format) *AdvancedQueries

func (*AdvancedQueries) WithNumberRateFormat

func (q *AdvancedQueries) WithNumberRateFormat(f *Format) *AdvancedQueries

func (*AdvancedQueries) WithPercentFormat

func (q *AdvancedQueries) WithPercentFormat(f *Format) *AdvancedQueries

func (*AdvancedQueries) WithTimeFormat

func (q *AdvancedQueries) WithTimeFormat(f *Format) *AdvancedQueries

type AxesConfiguration

type AxesConfiguration struct {
	Bottom Bottom `json:"bottom"`
	Left   Left   `json:"left"`
	Right  Right  `json:"right"`
}

type Base

type Base struct {
	DisplayText string `json:"displayText"`
	Severity    string `json:"severity"`
}

type Bottom

type Bottom struct {
	Enabled bool `json:"enabled"`
}

type Dashboard

type Dashboard struct {
	Version                 int                    `json:"version,omitempty"`
	CustomerID              interface{}            `json:"customerId"`
	TeamID                  int                    `json:"teamId"`
	Schema                  int                    `json:"schema"`
	AutoCreated             bool                   `json:"autoCreated"`
	PublicToken             string                 `json:"publicToken"`
	ScopeExpressionList     []*ScopeExpressionList `json:"scopeExpressionList"`
	Layout                  []*Layout              `json:"layout"`
	TeamScope               interface{}            `json:"teamScope"`
	EventDisplaySettings    EventDisplaySettings   `json:"eventDisplaySettings"`
	ID                      int                    `json:"id,omitempty"`
	Name                    string                 `json:"name"`
	Description             string                 `json:"description"`
	Username                string                 `json:"username"`
	Shared                  bool                   `json:"shared"`
	SharingSettings         []*SharingOptions      `json:"sharingSettings"`
	Public                  bool                   `json:"public"`
	Favorite                bool                   `json:"favorite"`
	CreatedOn               int64                  `json:"createdOn"`
	ModifiedOn              int64                  `json:"modifiedOn"`
	Panels                  []*Panels              `json:"panels"`
	TeamScopeExpressionList []interface{}          `json:"teamScopeExpressionList"`
	CreatedOnDate           string                 `json:"createdOnDate"`
	ModifiedOnDate          string                 `json:"modifiedOnDate"`
	TeamSharingOptions      TeamSharingOptions     `json:"teamSharingOptions"`
}

func DashboardFromJSON

func DashboardFromJSON(body []byte) *Dashboard

func NewDashboard

func NewDashboard(name, description string) *Dashboard

func (*Dashboard) AddPanels

func (db *Dashboard) AddPanels(panels ...*Panels)

func (*Dashboard) AsPublic

func (db *Dashboard) AsPublic(value bool) *Dashboard

func (*Dashboard) ToJSON

func (db *Dashboard) ToJSON() io.Reader

type DisplayInfo

type DisplayInfo struct {
	DisplayName                   string `json:"displayName"`
	TimeSeriesDisplayNameTemplate string `json:"timeSeriesDisplayNameTemplate"`
	Type                          string `json:"type"`
	Color                         string `json:"color,omitempty"`
	LineWidth                     int    `json:"lineWidth,omitempty"`
}

type EventDisplaySettings

type EventDisplaySettings struct {
	Enabled     bool        `json:"enabled"`
	QueryParams QueryParams `json:"queryParams"`
}

type Format

type Format struct {
	Unit                 FormatUnit `json:"unit"`
	InputFormat          *string    `json:"inputFormat"`
	DisplayFormat        *string    `json:"displayFormat"`
	Decimals             *int       `json:"decimals"`
	YAxis                *string    `json:"yAxis"`
	MinInterval          *string    `json:"minInterval"`
	NullValueDisplayMode *string    `json:"nullValueDisplayMode"`
}

func NewFormat added in v0.7.0

func NewFormat(
	unit FormatUnit,
	inputFormat string,
	displayFormat string,
	decimals int,
	yAxis string,
	minInterval string,
	nullValueDisplayMode string) *Format

type FormatUnit

type FormatUnit string
const (
	FormatUnitPercentage FormatUnit = "%"
	FormatUnitData       FormatUnit = "byte"
	FormatUnitDataRate   FormatUnit = "byteRate"
	FormatUnitNumber     FormatUnit = "number"
	FormatUnitNumberRate FormatUnit = "numberRate"
	FormatUnitTime       FormatUnit = "relativeTime"
)

type Layout

type Layout struct {
	X       int `json:"x"`
	Y       int `json:"y"`
	W       int `json:"w"`
	H       int `json:"h"`
	PanelID int `json:"panelId"`
}

type Left

type Left struct {
	Enabled        bool        `json:"enabled"`
	DisplayName    interface{} `json:"displayName"`
	Unit           string      `json:"unit"`
	DisplayFormat  string      `json:"displayFormat"`
	Decimals       interface{} `json:"decimals"`
	MinValue       int         `json:"minValue"`
	MaxValue       interface{} `json:"maxValue"`
	MinInputFormat string      `json:"minInputFormat"`
	MaxInputFormat string      `json:"maxInputFormat"`
	Scale          string      `json:"scale"`
}

type LegendConfiguration

type LegendConfiguration struct {
	Enabled     bool        `json:"enabled"`
	Position    string      `json:"position"`
	Layout      string      `json:"layout"`
	ShowCurrent bool        `json:"showCurrent"`
	Width       interface{} `json:"width"`
	Height      interface{} `json:"height"`
}

type NumberThresholds

type NumberThresholds struct {
	Base   Base          `json:"base"`
	Values []interface{} `json:"values"`
}

type PanelType

type PanelType string
const (
	PanelTypeTimechart PanelType = "advancedTimechart"
	PanelTypeNumber    PanelType = "advancedNumber"
	PanelTypeText      PanelType = "text"
)

type Panels

type Panels struct {
	ID                     int                  `json:"id"`
	Name                   string               `json:"name"`
	Description            string               `json:"description"`
	AxesConfiguration      *AxesConfiguration   `json:"axesConfiguration,omitempty"`
	LegendConfiguration    *LegendConfiguration `json:"legendConfiguration,omitempty"`
	ApplyScopeToAll        bool                 `json:"applyScopeToAll,omitempty"`
	ApplySegmentationToAll bool                 `json:"applySegmentationToAll,omitempty"`
	AdvancedQueries        []*AdvancedQueries   `json:"advancedQueries,omitempty"`
	NumberThresholds       *NumberThresholds    `json:"numberThresholds,omitempty"`
	MarkdownSource         *string              `json:"markdownSource,omitempty"`
	PanelTitleVisible      bool                 `json:"panelTitleVisible"`
	TextAutosized          bool                 `json:"textAutosized"`
	TransparentBackground  bool                 `json:"transparentBackground"`
	Type                   PanelType            `json:"type"`
	// Just a helper to the client, the actual field is in Dashboard
	Layout *Layout `json:"-"`
}

func (*Panels) AddQueries

func (p *Panels) AddQueries(queries ...*AdvancedQueries) (*Panels, error)

func (*Panels) WithLayout

func (p *Panels) WithLayout(xPos, yPos, width, height int) (*Panels, error)

type QueryParams

type QueryParams struct {
	Severities    []interface{} `json:"severities"`
	AlertStatuses []interface{} `json:"alertStatuses"`
	Categories    []interface{} `json:"categories"`
	Filter        string        `json:"filter"`
	TeamScope     bool          `json:"teamScope"`
}
type Right struct {
	Enabled        bool        `json:"enabled"`
	DisplayName    interface{} `json:"displayName"`
	Unit           string      `json:"unit"`
	DisplayFormat  string      `json:"displayFormat"`
	Decimals       interface{} `json:"decimals"`
	MinValue       int         `json:"minValue"`
	MaxValue       interface{} `json:"maxValue"`
	MinInputFormat string      `json:"minInputFormat"`
	MaxInputFormat string      `json:"maxInputFormat"`
	Scale          string      `json:"scale"`
}

type ScopeExpressionList added in v0.5.11

type ScopeExpressionList struct {
	Operand     string      `json:"operand"`
	Operator    string      `json:"operator"`
	DisplayName string      `json:"displayName"`
	Value       []string    `json:"value"`
	Descriptor  interface{} `json:"descriptor"`
	IsVariable  bool        `json:"isVariable"`
}

type SharingMember added in v0.5.30

type SharingMember struct {
	Type string `json:"type"`
	ID   int    `json:"id"`
}

type SharingOptions added in v0.5.30

type SharingOptions struct {
	Member SharingMember `json:"member"`
	Role   string        `json:"role"`
}

type TeamSharingOptions

type TeamSharingOptions struct {
	Type          string        `json:"type"`
	UserTeamsRole string        `json:"userTeamsRole"`
	SelectedTeams []interface{} `json:"selectedTeams"`
}

Jump to

Keyboard shortcuts

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