grafana/pkg/models/datasource.go

79 lines
1.2 KiB
Go
Raw Normal View History

2014-12-16 19:04:08 +08:00
package models
2014-12-19 03:26:06 +08:00
import (
"errors"
"time"
)
2014-12-16 19:04:08 +08:00
const (
DS_GRAPHITE = "graphite"
DS_INFLUXDB = "influxdb"
DS_ES = "es"
DS_ACCESS_DIRECT = "direct"
DS_ACCESS_PROXY = "proxy"
2014-12-16 19:04:08 +08:00
)
2014-12-19 03:26:06 +08:00
// Typed errors
var (
ErrDataSourceNotFound = errors.New("Data source not found")
)
2014-12-16 19:04:08 +08:00
type DsType string
type DsAccess string
type DataSource struct {
Id int64
AccountId int64
Name string
Type DsType
Access DsAccess
Url string
Password string
User string
Database string
2014-12-16 19:04:08 +08:00
BasicAuth bool
Created time.Time
Updated time.Time
}
type GetDataSourcesQuery struct {
AccountId int64
2014-12-18 00:32:22 +08:00
Result []*DataSource
2014-12-16 19:04:08 +08:00
}
2014-12-16 23:45:07 +08:00
type GetDataSourceByIdQuery struct {
Id int64
2014-12-19 03:26:06 +08:00
AccountId int64
Result DataSource
}
2014-12-16 23:45:07 +08:00
type AddDataSourceCommand struct {
AccountId int64
Name string
Type DsType
Access DsAccess
Url string
Password string
Database string
2014-12-16 23:45:07 +08:00
User string
}
2014-12-18 00:32:22 +08:00
type UpdateDataSourceCommand struct {
Id int64
AccountId int64
Name string
Type DsType
Access DsAccess
Url string
Password string
User string
Database string
2014-12-18 00:32:22 +08:00
}
type DeleteDataSourceCommand struct {
Id int64
AccountId int64
}