api

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CmonStatuses = []CmonStatus{
		Ok,
		Failed,
		AuthenticationError,
	}
)

Functions

func Paginate

func Paginate(listRequest ListRequest, length int) (int, int)

func PassFilter

func PassFilter(filters []*Filter, key, value string) bool

func PassFilterLazy

func PassFilterLazy(filters []*Filter, key string, fn LazyStringFn) bool

func PassTagsFilterLazy

func PassTagsFilterLazy(filters []*Filter, tagsFn LazyStringSlFn) bool

PassTagsFilterLazy checks if all the defined tags in filter.MatchAll are in the 'tags' list

Types

type AddControllerRequest

type AddControllerRequest struct {
	Controller *config.CmonInstance `json:"controller"`
}

AddControllerRequest can be used to add or test a cmon instance to the system

type AddControllerResponse

type AddControllerResponse struct {
	*cmonapi.Error

	Controller *ControllerStatus `json:"controller"`
}

AddControllerResponse contains the controller status message

type AlarmExt

type AlarmExt struct {
	*WithControllerID
	*cmonapi.Alarm
}

AlarmExt is a cmon alarm extended by controller ID / URL fields

type AlarmListReply

type AlarmListReply struct {
	ListResponse `json:",inline"`
	Alarms       []*AlarmExt                  `json:"alarms"`
	LastUpdated  map[string]*cmonapi.NullTime `json:"last_updated"`
}

func (*AlarmListReply) Add

func (al *AlarmListReply) Add(alarm *cmonapi.Alarm, controllerUrl, controllerId string)

type AlarmListRequest

type AlarmListRequest struct {
	ListRequest `json:",inline"`
}

type AlarmsOverview

type AlarmsOverview struct {
	// Alarm counts by severity
	AlarmCounts map[string]int `json:"alarms_count"`
	// Alarm counts by type
	AlarmTypes map[string]int `json:"alarm_types"`

	// Alarm counts by controller
	AlarmCountsByController map[string]*AlarmsOverview `json:"by_controller,omitempty"`

	// for the "technology" filters
	ByClusterType map[string]*AlarmsOverview `json:"by_cluster_type,omitempty"`
}

type BackupExt

type BackupExt struct {
	*WithControllerID
	*api.Backup
}

BackupExt is a cmon Job extended by controller ID / URL fields

type BackupListReply

type BackupListReply struct {
	ListResponse `json:",inline"`
	Backups      []*BackupExt                 `json:"backups"`
	LastUpdated  map[string]*cmonapi.NullTime `json:"last_updated"`
}

type BackupListRequest

type BackupListRequest struct {
	ListRequest `json:",inline"`
}

type BackupOverview

type BackupOverview struct {
	// Backup counts by severity
	BackupCounts map[string]int `json:"backups_count"`

	// Backup counts by controller
	BackupCountsByController map[string]*BackupOverview `json:"by_controller,omitempty"`

	// The number of clusters missing schedules
	MissingSchedules int `json:"missing_schedules"`

	// The number of schedules
	SchedulesCount int `json:"schedules_count"`

	// for the "technology" filters
	ByClusterType map[string]*BackupOverview `json:"by_cluster_type,omitempty"`
}

type ClusterExt

type ClusterExt struct {
	*WithControllerID
	*cmonapi.Cluster
}

ClusterExt is a cmon cluster extended by controller ID / URL fields

type ClusterListReply

type ClusterListReply struct {
	ListResponse `json:",inline"`
	Clusters     []*ClusterExt                `json:"clusters"`
	LastUpdated  map[string]*cmonapi.NullTime `json:"last_updated"`
}

type ClusterListRequest

type ClusterListRequest struct {
	ListRequest `json:",inline"`
	WithHosts   bool `json:"with_hosts,omitempty"`
}

type ClustersOverview

type ClustersOverview struct {
	// an overview of all clusters status (map key: status string)
	// for complete list see: https://github.com/severalnines/clustercontrol-enterprise/blob/master/src/cmoncluster.cpp#L3924
	ClusterStatus map[string]int `json:"cluster_states"`
	// clusters count by controller (map key: URL)
	ClustersCount map[string]int `json:"clusters_count"`
	NodesCount    map[string]int `json:"nodes_count,omitempty"`
	// the node states see:
	NodeStates map[string]int `json:"node_states,omitempty"`

	// for the "technology" filters
	ByClusterType map[string]*ClustersOverview `json:"by_cluster_type,omitempty"`
}

type CmonStatus

type CmonStatus string
const (
	Ok                  CmonStatus = "ok"
	Failed              CmonStatus = "failed"
	AuthenticationError CmonStatus = "authentication-error"
)

func (CmonStatus) String

func (st CmonStatus) String() string

String implements Stringer interface

type ControllerStatus

type ControllerStatus struct {
	ControllerID  string           `json:"controller_id"`
	Name          string           `json:"controller_name"`
	Url           string           `json:"url"`
	FrontendUrl   string           `json:"frontend_url,omitempty"`
	Version       string           `json:"version"`
	StatusMessage string           `json:"status_message"`
	Status        CmonStatus       `json:"status"`
	LastUpdated   cmonapi.NullTime `json:"last_updated"`
	LastSeen      cmonapi.NullTime `json:"last_seen"`
}

type ControllerStatusList

type ControllerStatusList struct {
	Controllers []*ControllerStatus `json:"controllers"`
}

type Filter

type Filter struct {
	Key      string   `json:"key"`
	Value    string   `json:"value,omitempty"`
	Values   []string `json:"values,omitempty"`   /* OR like filter */
	MatchAll []string `json:"matchall,omitempty"` /* all values specified here must match, for tags */
}

Filter is a generic filter by a key and accepted values

func (*Filter) AcceptsValue

func (f *Filter) AcceptsValue(value string) bool

type HostExt

type HostExt struct {
	*WithControllerID
	*cmonapi.Host
}

ClusterExt is a cmon cluster extended by controller ID / URL fields

type HostListReply

type HostListReply struct {
	ListResponse `json:",inline"`
	// the hosts after filtration
	Hosts []*HostExt `json:"hosts"`
	// the last update timestamp of each cmon instance
	LastUpdated map[string]*cmonapi.NullTime `json:"last_updated"`
}

type HostListRequest

type HostListRequest struct {
	ListRequest `json:",inline"`
}

type JobExt

type JobExt struct {
	*WithControllerID
	*api.Job
}

JobExt is a cmon Job extended by controller ID / URL fields

type JobListReply

type JobListReply struct {
	ListResponse `json:",inline"`
	Jobs         []*JobExt                    `json:"jobs"`
	LastUpdated  map[string]*cmonapi.NullTime `json:"last_updated"`
}

type JobListRequest

type JobListRequest struct {
	ListRequest `json:",inline"`
}

type JobsStatus

type JobsStatus struct {
	// Job counts by job status
	JobCounts map[string]int `json:"job_count"`
	// Job counts by job commands
	JobCommands map[string]int `json:"job_commands"`

	// Job counts by controller
	JobCountsByController map[string]*JobsStatus `json:"by_controller,omitempty"`

	// for the "technology" filters
	ByClusterType map[string]*JobsStatus `json:"by_cluster_type,omitempty"`
}

type LazyStringFn

type LazyStringFn func() string

type LazyStringSlFn

type LazyStringSlFn func() []string

type ListRequest

type ListRequest struct {
	Page    uint64    `json:"page"`
	PerPage uint64    `json:"perPage"`
	Order   string    `json:"order"`
	Filters []*Filter `json:"filters"`
}

func (ListRequest) GetOrder

func (listRequest ListRequest) GetOrder() (order string, descending bool)

type ListResponse

type ListResponse struct {
	Page    uint64 `json:"page,omitempty"`
	PerPage uint64 `json:"perPage,omitempty"`
	Total   uint64 `json:"total,omitempty"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

type LoginResponse

type LoginResponse struct {
	*cmonapi.WithResponseData `json:",inline"`

	User *config.ProxyUser `json:"user,omitempty"`
}

type RemoveControllerRequest

type RemoveControllerRequest struct {
	Url string `json:"url"`
}

RemoveControllerRequest can be sent to remove a controller by URL

type SetPasswordRequest

type SetPasswordRequest struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

type SimpleFilteredRequest

type SimpleFilteredRequest struct {
	Filters []*Filter `json:"filters"`
}

type UpdateUserRequest

type UpdateUserRequest struct {
	User *config.ProxyUser `json:"user,omitempty"`
}

type WithControllerID

type WithControllerID struct {
	ControllerID  string `json:"controller_id"`
	ControllerURL string `json:"controller_url"`
}

WithControllerID is used in replies to extend the standard cmon replies

Jump to

Keyboard shortcuts

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