migrate

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecutePanelScript added in v0.52.0

func ExecutePanelScript(cueScript *build.Instance, grafanaPanelData []byte) (*common.Plugin, bool, error)

func ExecuteQueryScript added in v0.52.0

func ExecuteQueryScript(cueScript *build.Instance, grafanaQueryData []byte) (*common.Plugin, bool, error)

func ExecuteVariableScript added in v0.52.0

func ExecuteVariableScript(cueScript *build.Instance, grafanaVariableData []byte) (*common.Plugin, bool, error)

func GetPluginKind added in v0.52.0

func GetPluginKind(migrateFile string) (plugin.Kind, error)

GetPluginKind guesses the plugin kind from a migration file based on expected patterns

func Load

func Load(pluginPath string, moduleSpec plugin.ModuleSpec) ([]schema.LoadSchema, error)

func LoadMigrateSchema

func LoadMigrateSchema(schemaPath string) (*build.Instance, error)

func ReplaceInputValue

func ReplaceInputValue(input map[string]string, grafanaDashboard string) string

Types

type CurrentValue

type CurrentValue struct {
	Value *variable.DefaultValue `json:"value,omitempty"`
}
type GrafanaLink struct {
	Title       string `json:"title"`
	URL         string `json:"url"`
	TargetBlank bool   `json:"targetBlank"`
}

type GridPosition

type GridPosition struct {
	Height int `json:"h"`
	Width  int `json:"w"`
	X      int `json:"x"`
	Y      int `json:"y"`
}

type Migration

type Migration interface {
	Load(pluginPath string, module v1.PluginModule) error
	LoadDevPlugin(pluginPath string, module v1.PluginModule) error
	UnLoadDevPlugin(module v1.PluginModule)
	Migrate(grafanaDashboard *SimplifiedDashboard) (*v1.Dashboard, error)
}

func New

func New() Migration

type Panel

type Panel struct {
	Type         string            `json:"type"`
	Title        string            `json:"title"`
	Description  string            `json:"description"`
	Collapsed    bool              `json:"collapsed"`
	Panels       []Panel           `json:"panels"`
	GridPosition GridPosition      `json:"gridPos"`
	Targets      []json.RawMessage `json:"targets"`
	Links        []GrafanaLink     `json:"links"`
	json.RawMessage
}

func (*Panel) UnmarshalJSON

func (p *Panel) UnmarshalJSON(data []byte) error

type SimplifiedDashboard

type SimplifiedDashboard struct {
	UID        string  `json:"uid,omitempty"`
	Title      string  `json:"title"`
	Panels     []Panel `json:"panels"`
	Templating struct {
		List []TemplateVar `json:"list"`
	} `json:"templating"`
}

func (*SimplifiedDashboard) UnmarshalJSON

func (d *SimplifiedDashboard) UnmarshalJSON(data []byte) error

type TemplateVar

type TemplateVar struct {
	Name        string          `json:"name"`
	Type        string          `json:"type"`
	Description string          `json:"description"`
	Label       string          `json:"label"`
	Hide        int             `json:"hide"`
	Sort        *int            `json:"sort,omitempty"`
	IncludeAll  bool            `json:"includeAll"`
	AllValue    string          `json:"allValue"`
	Multi       bool            `json:"multi"`
	Current     *CurrentValue   `json:"current,omitempty"`
	Query       json.RawMessage `json:"query"`
	json.RawMessage
}

func (*TemplateVar) UnmarshalJSON

func (v *TemplateVar) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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