models

package
Version: v1.7.1-0...-29a0ac7 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCollectorNotFound           = errors.New("Collector not found")
	ErrCollectorWithSameCodeExists = errors.New("A Collector with the same code already exists")
)

Typed errors

View Source
var (
	ErrEndpointNotFound   = errors.New("Endpoint not found")
	ErrWithMonitorsDelete = errors.New("Endpoint can't be deleted as it still has monitors")
)

Typed errors

View Source
var (
	ErrMonitorNotFound          = errors.New("Monitor not found")
	ErrMonitorCollectorsInvalid = errors.New("Invalid Collector specified for Monitor")
	ErrMonitorSettingsInvalid   = errors.New("Invald variables used in Monitor Settings")
	ErrorEndpointCantBeChanged  = errors.New("A monitor's endpoint_id can not be changed.")
)

Typed errors

View Source
var (
	ErrInvalidRoleType     = errors.New("Invalid role type")
	ErrLastOrgAdmin        = errors.New("Cannot remove last organization admin")
	ErrOrgUserNotFound     = errors.New("Cannot find the organization user")
	ErrOrgUserAlreadyAdded = errors.New("User is already added to organization")
	ErrInvalidApiKey       = errors.New("Invalid API Key")
)

Typed errors

View Source
var ErrInvalidEmailCode = errors.New("Invalid or expired email code")
View Source
var ErrInvalidQuotaTarget = errors.New("Invalid quota target")

Functions

This section is empty.

Types

type AddCollectorCommand

type AddCollectorCommand struct {
	OrgId     int64    `json:"-"`
	Name      string   `json:"name" binding:"Required"`
	Tags      []string `json:"tags"`
	Public    bool     `json:"public"`
	Online    bool     `json:"online"`
	Enabled   bool     `json:"enabled"`
	Latitude  float64  `json:"latitude"`
	Longitude float64  `json:"longitude"`
	Result    *CollectorDTO
}

type AddCollectorSessionCommand

type AddCollectorSessionCommand struct {
	CollectorId int64
	SocketId    string
	OrgId       int64
	InstanceId  string
}

type AddEndpointCommand

type AddEndpointCommand struct {
	OrgId    int64                `json:"-"`
	Name     string               `json:"name" binding:"Required"`
	Tags     []string             `json:"tags"`
	Monitors []*AddMonitorCommand `json:"monitors"`
	Result   *EndpointDTO         `json:"-"`
}

type AddMonitorCommand

type AddMonitorCommand struct {
	OrgId          int64                    `json:"-"`
	EndpointId     int64                    `json:"endpoint_id" binding:"Required"`
	MonitorTypeId  int64                    `json:"monitor_type_id" binding:"Required"`
	CollectorIds   []int64                  `json:"collector_ids"`
	CollectorTags  []string                 `json:"collector_tags"`
	Settings       []*MonitorSettingDTO     `json:"settings"`
	HealthSettings *MonitorHealthSettingDTO `json:"health_settings"`
	Frequency      int64                    `json:"frequency" binding:"Required;Range(10,600)"`
	Enabled        bool                     `json:"enabled"`
	Offset         int64                    `json:"-"`
	Result         *MonitorDTO              `json:"-"`
}

type AlertSchedulerValue

type AlertSchedulerValue struct {
	Id    string
	Value string
}

type CheckEvalResult

type CheckEvalResult int
const (
	EvalResultOK CheckEvalResult = iota
	EvalResultWarn
	EvalResultCrit
	EvalResultUnknown = -1
)

func (CheckEvalResult) String

func (c CheckEvalResult) String() string

type ClearCollectorSessionCommand

type ClearCollectorSessionCommand struct {
	InstanceId string
}

type Collector

type Collector struct {
	Id            int64
	OrgId         int64
	Slug          string
	Name          string
	Public        bool
	Latitude      float64
	Longitude     float64
	Created       time.Time
	Updated       time.Time
	Online        bool
	OnlineChange  time.Time
	Enabled       bool
	EnabledChange time.Time
}

func (*Collector) UpdateCollectorSlug

func (collector *Collector) UpdateCollectorSlug()

type CollectorDTO

type CollectorDTO struct {
	Id            int64     `json:"id"`
	OrgId         int64     `json:"org_id"`
	Slug          string    `json:"slug"`
	Name          string    `json:"name"`
	Tags          []string  `json:"tags"`
	Public        bool      `json:"public"`
	Latitude      float64   `json:"latitude"`
	Longitude     float64   `json:"longitude"`
	Online        bool      `json:"online"`
	OnlineChange  time.Time `json:"online_change"`
	Enabled       bool      `json:"enabled"`
	EnabledChange time.Time `json:"enabled_change"`
}

---------------------- DTO

type CollectorSession

type CollectorSession struct {
	Id          int64
	OrgId       int64
	CollectorId int64
	SocketId    string
	InstanceId  string
	Updated     time.Time
}

type CollectorTag

type CollectorTag struct {
	Id          int64
	OrgId       int64
	CollectorId int64
	Tag         string
}

type DeleteCollectorCommand

type DeleteCollectorCommand struct {
	Id    int64 `json:"id" binding:"Required"`
	OrgId int64 `json:"-"`
}

type DeleteCollectorSessionCommand

type DeleteCollectorSessionCommand struct {
	OrgId       int64
	SocketId    string
	CollectorId int64
}

type DeleteEndpointCommand

type DeleteEndpointCommand struct {
	Id    int64 `json:"id" binding:"Required"`
	OrgId int64 `json:"-"`
}

type DeleteMonitorCommand

type DeleteMonitorCommand struct {
	Id    int64 `json:"id" binding:"Required"`
	OrgId int64 `json:"-"`
}

type Endpoint

type Endpoint struct {
	Id      int64
	OrgId   int64
	Name    string
	Slug    string
	Created time.Time
	Updated time.Time
}

func (*Endpoint) UpdateEndpointSlug

func (endpoint *Endpoint) UpdateEndpointSlug()

type EndpointDTO

type EndpointDTO struct {
	Id    int64    `json:"id"`
	OrgId int64    `json:"org_id"`
	Name  string   `json:"name"`
	Slug  string   `json:"slug"`
	Tags  []string `json:"tags"`
}

--------------- DTOs

type EndpointDiscoveryCommand

type EndpointDiscoveryCommand struct {
	Name   string `form:"name"`
	Result []*SuggestedMonitor
}

---------------------- COMMANDS

type EndpointTag

type EndpointTag struct {
	Id         int64
	OrgId      int64
	EndpointId int64
	Tag        string
}

type GetAlertSchedulerValueQuery

type GetAlertSchedulerValueQuery struct {
	Id     string
	Result string
}

type GetAllCollectorTagsQuery

type GetAllCollectorTagsQuery struct {
	OrgId  int64
	Result []string
}

type GetAllEndpointTagsQuery

type GetAllEndpointTagsQuery struct {
	OrgId  int64
	Result []string
}

type GetCollectorByIdQuery

type GetCollectorByIdQuery struct {
	Id     int64
	OrgId  int64
	Result *CollectorDTO
}

type GetCollectorByNameQuery

type GetCollectorByNameQuery struct {
	Name   string
	OrgId  int64
	Result *CollectorDTO
}

type GetCollectorSessionsQuery

type GetCollectorSessionsQuery struct {
	CollectorId int64
	InstanceId  string
	Result      []*CollectorSession
}

type GetCollectorsQuery

type GetCollectorsQuery struct {
	Slug   []string `form:"slug"`
	Name   []string `form:"name"`
	Tag    []string `form:"tag"`
	Public string   `form:"public"`
	OrgId  int64
	Result []*CollectorDTO
}

type GetEndpointByIdQuery

type GetEndpointByIdQuery struct {
	Id     int64
	OrgId  int64
	Result *EndpointDTO
}

type GetEndpointsQuery

type GetEndpointsQuery struct {
	OrgId  int64
	Tag    []string `form:"tag"`
	Result []*EndpointDTO
}

type GetEventsQuery

type GetEventsQuery struct {
	OrgId  int64
	Query  string `form:"query"`
	Start  int64  `form:"start"`
	End    int64  `form:"end"`
	Size   int    `form:"size"`
	Result []*schema.ProbeEvent
}

type GetGlobalQuotaByTargetQuery

type GetGlobalQuotaByTargetQuery struct {
	Target  string
	Default int64
	Result  *GlobalQuotaDTO
}

type GetMonitorByIdQuery

type GetMonitorByIdQuery struct {
	Id             int64
	OrgId          int64
	IsGrafanaAdmin bool
	Result         *MonitorDTO
}

type GetMonitorTypeByIdQuery

type GetMonitorTypeByIdQuery struct {
	Id     int64
	Result *MonitorTypeDTO
}

type GetMonitorTypesQuery

type GetMonitorTypesQuery struct {
	Result []*MonitorTypeDTO
}

type GetMonitorsForAlertsQuery

type GetMonitorsForAlertsQuery struct {
	Timestamp int64
	Result    []*MonitorForAlertDTO
}

type GetMonitorsQuery

type GetMonitorsQuery struct {
	MonitorId      []int64         `form:"id"`
	EndpointId     []int64         `form:"endpoint_id"`
	MonitorTypeId  []int64         `form:"monitor_type_id"`
	CollectorId    []int64         `form:"collector_id"`
	Frequency      []int64         `form:"frequency"`
	Enabled        string          `form:"enabled"`
	Modulo         int64           `form:"modulo"`
	ModuloOffset   int64           `form:"modulo_offset"`
	State          CheckEvalResult `form:"state"`
	OrgId          int64
	IsGrafanaAdmin bool
	Result         []*MonitorDTO
}

type GetOrgQuotaByTargetQuery

type GetOrgQuotaByTargetQuery struct {
	Target  string
	OrgId   int64
	Default int64
	Result  *OrgQuotaDTO
}

type GetOrgQuotasQuery

type GetOrgQuotasQuery struct {
	OrgId  int64
	Result []*OrgQuotaDTO
}

type GlobalQuotaDTO

type GlobalQuotaDTO struct {
	Target string `json:"target"`
	Limit  int64  `json:"limit"`
	Used   int64  `json:"used"`
}

type Monitor

type Monitor struct {
	Id             int64
	OrgId          int64
	EndpointId     int64
	MonitorTypeId  int64
	Offset         int64
	Frequency      int64
	Enabled        bool
	State          CheckEvalResult
	StateChange    time.Time
	StateCheck     time.Time
	Settings       []*MonitorSettingDTO
	HealthSettings *MonitorHealthSettingDTO
	Created        time.Time
	Updated        time.Time
}

type MonitorCollector

type MonitorCollector struct {
	Id          int64
	MonitorId   int64
	CollectorId int64
}

type MonitorCollectorTag

type MonitorCollectorTag struct {
	Id        int64
	MonitorId int64
	Tag       string
}

type MonitorDTO

type MonitorDTO struct {
	Id              int64                    `json:"id"`
	OrgId           int64                    `json:"org_id"`
	EndpointId      int64                    `json:"endpoint_id" `
	EndpointSlug    string                   `json:"endpoint_slug"`
	MonitorTypeId   int64                    `json:"monitor_type_id"`
	MonitorTypeName string                   `json:"monitor_type_name"`
	CollectorIds    []int64                  `json:"collector_ids"`
	CollectorTags   []string                 `json:"collector_tags"`
	Collectors      []int64                  `json:"collectors"`
	State           CheckEvalResult          `json:"state"`
	StateChange     time.Time                `json:"state_change"`
	StateCheck      time.Time                `json:"state_check"`
	Settings        []*MonitorSettingDTO     `json:"settings"`
	HealthSettings  *MonitorHealthSettingDTO `json:"health_settings"`
	Frequency       int64                    `json:"frequency"`
	Enabled         bool                     `json:"enabled"`
	Offset          int64                    `json:"offset"`
	Updated         time.Time                `json:"updated"`
}

type MonitorForAlertDTO

type MonitorForAlertDTO struct {
	Id              int64
	OrgId           int64
	EndpointId      int64
	EndpointSlug    string
	EndpointName    string
	MonitorTypeId   int64
	MonitorTypeName string
	Offset          int64
	Frequency       int64
	Enabled         bool
	StateChange     time.Time
	StateCheck      time.Time
	Settings        []*MonitorSettingDTO
	HealthSettings  *MonitorHealthSettingDTO
	Created         time.Time
	Updated         time.Time
}

func (*MonitorForAlertDTO) SettingsMap

func (m *MonitorForAlertDTO) SettingsMap() map[string]string

type MonitorHealthSettingDTO

type MonitorHealthSettingDTO struct {
	NumCollectors int                        `json:"num_collectors" binding:"Required"`
	Steps         int                        `json:"steps" binding:"Required"`
	Notifications MonitorNotificationSetting `json:"notifications"`
}

func (*MonitorHealthSettingDTO) FromDB

func (e *MonitorHealthSettingDTO) FromDB(data []byte) error

implement the go-xorm/core.Conversion interface

func (*MonitorHealthSettingDTO) ToDB

func (e *MonitorHealthSettingDTO) ToDB() ([]byte, error)

type MonitorNotificationSetting

type MonitorNotificationSetting struct {
	Enabled   bool   `json:"enabled"`
	Addresses string `json:"addresses"`
}

type MonitorSettingDTO

type MonitorSettingDTO struct {
	Variable string `json:"variable" binding:"Required"`
	Value    string `json:"value"`
}

type MonitorType

type MonitorType struct {
	Id      int64
	Name    string
	Created time.Time
	Updated time.Time
}

type MonitorTypeDTO

type MonitorTypeDTO struct {
	Id       int64                    `json:"id"`
	Name     string                   `json:"name"`
	Settings []*MonitorTypeSettingDTO `json:"settings"`
}

type MonitorTypeSetting

type MonitorTypeSetting struct {
	Id            int64
	MonitorTypeId int64
	Variable      string
	Description   string
	Required      bool
	DataType      string
	DefaultValue  string
	Conditions    map[string]interface{}
}

type MonitorTypeSettingDTO

type MonitorTypeSettingDTO struct {
	Variable     string                 `json:"variable"`
	Description  string                 `json:"description"`
	Required     bool                   `json:"required"`
	DataType     string                 `json:"data_type"`
	Conditions   map[string]interface{} `json:"conditions"`
	DefaultValue string                 `json:"default_value"`
}

type OAuthType

type OAuthType int
const (
	GITHUB OAuthType = iota + 1
	GOOGLE
	TWITTER
)

type OrgQuotaDTO

type OrgQuotaDTO struct {
	OrgId  int64  `json:"org_id"`
	Target string `json:"target"`
	Limit  int64  `json:"limit"`
	Used   int64  `json:"used"`
}

type Quota

type Quota struct {
	Id      int64
	OrgId   int64
	UserId  int64
	Target  string
	Limit   int64
	Created time.Time
	Updated time.Time
}

type QuotaScope

type QuotaScope struct {
	Name         string
	Target       string
	DefaultLimit int64
}

func GetQuotaScopes

func GetQuotaScopes(target string) ([]QuotaScope, error)

type RoleType

type RoleType string
const (
	ROLE_VIEWER           RoleType = "Viewer"
	ROLE_EDITOR           RoleType = "Editor"
	ROLE_READ_ONLY_EDITOR RoleType = "Read Only Editor"
	ROLE_ADMIN            RoleType = "Admin"
)

func (RoleType) IsValid

func (r RoleType) IsValid() bool

type SendEmailCommand

type SendEmailCommand struct {
	To       []string
	Template string
	Data     map[string]interface{}
	Massive  bool
	Info     string
}

type SignedInUser

type SignedInUser struct {
	UserId         int64
	OrgId          int64
	OrgName        string
	OrgRole        RoleType
	Login          string
	Name           string
	Email          string
	Theme          string
	ApiKeyId       int64
	IsGrafanaAdmin bool
}

type SuggestedMonitor

type SuggestedMonitor struct {
	MonitorTypeId int64               `json:"monitor_type_id"`
	Settings      []MonitorSettingDTO `json:"settings"`
}

type UpdateAlertSchedulerValueCommand

type UpdateAlertSchedulerValueCommand struct {
	Id    string
	Value string
}

type UpdateCollectorCommand

type UpdateCollectorCommand struct {
	Id        int64    `json:"id" binding:"Required"`
	OrgId     int64    `json:"-"`
	Name      string   `json:"name" binding:"Required"`
	Tags      []string `json:"tags"`
	Public    bool     `json:"public"`
	Enabled   bool     `json:"enabled"`
	Latitude  float64  `json:"latitude"`
	Longitude float64  `json:"longitude"`
}

type UpdateCollectorSessionCmd

type UpdateCollectorSessionCmd struct {
	CollectorId int64
	SocketId    string
	OrgId       int64
	InstanceId  string
}

type UpdateEndpointCommand

type UpdateEndpointCommand struct {
	Id     int64    `json:"id" binding:"Required"`
	OrgId  int64    `json:"-"`
	Name   string   `json:"name" binding:"Required"`
	Tags   []string `json:"tags"`
	Result *EndpointDTO
}

type UpdateMonitorCommand

type UpdateMonitorCommand struct {
	Id             int64                    `json:"id" binding:"Required"`
	EndpointId     int64                    `json:"endpoint_id" binding:"Required"`
	OrgId          int64                    `json:"-"`
	MonitorTypeId  int64                    `json:"monitor_type_id" binding:"Required"`
	CollectorIds   []int64                  `json:"collector_ids"`
	CollectorTags  []string                 `json:"collector_tags"`
	Settings       []*MonitorSettingDTO     `json:"settings"`
	HealthSettings *MonitorHealthSettingDTO `json:"health_settings"`
	Frequency      int64                    `json:"frequency" binding:"Required;Range(10,600)"`
	Enabled        bool                     `json:"enabled"`
	Offset         int64                    `json:"-"`
}

type UpdateMonitorStateCommand

type UpdateMonitorStateCommand struct {
	Id       int64
	State    CheckEvalResult
	Updated  time.Time
	Checked  time.Time
	Affected int
}

type UpdateOrgQuotaCmd

type UpdateOrgQuotaCmd struct {
	Target string `json:"target"`
	Limit  int64  `json:"limit"`
	OrgId  int64  `json:"-"`
}

Jump to

Keyboard shortcuts

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