Documentation
¶
Index ¶
- func Create(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)
- func Delete(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)
- func GetMetricProfile(input MongoInterface) (string, error)
- func HandleSubrouter(s *mux.Router, confhandler *respond.ConfHandler)
- func List(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)
- func ListOne(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)
- func Options(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)
- func ReportNotFound(contentType string) ([]byte, error)
- func SubmitSuccesful(inserted MongoInterface, contentType string, link string) ([]byte, error)
- func Update(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)
- type Computations
- type Info
- type Message
- type MongoInterface
- func (report MongoInterface) DetermineGroupType(groupType string) string
- func (report MongoInterface) GetEndpointGroupType() string
- func (report MongoInterface) GetGroupType() string
- func (report *MongoInterface) ValidateProfiles(db *mongo.Database) []respond.ErrorResponse
- func (report *MongoInterface) ValidateTrends() []respond.ErrorResponse
- type Profile
- type RootXML
- type Tag
- type Thresholds
- type Topology
- type TopologyLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create function is used to implement the create report request. The request is an http POST request with the report description provided as json structure in the request body
func GetMetricProfile ¶
func GetMetricProfile(input MongoInterface) (string, error)
GetMetricProfile is a function that takes a report struc element and returns the name of the metric profile (if exists)
func HandleSubrouter ¶
func HandleSubrouter(s *mux.Router, confhandler *respond.ConfHandler)
HandleSubrouter uses the subrouter for a specific calls and creates a tree of sorts handling each route with a different subrouter
func List ¶
List function that implements the http GET request that retrieves all available report information
func ListOne ¶
ListOne function that implements the http GET request that retrieves the specified report's information
func ReportNotFound ¶
ReportNotFound consructs marshals a response struct when the requested report is not found
func SubmitSuccesful ¶
func SubmitSuccesful(inserted MongoInterface, contentType string, link string) ([]byte, error)
SubmitSuccesful marshals a response struct when a report is successfully inserted in the database
Types ¶
type Computations ¶
type Computations struct {
AR bool `bson:"ar" json:"ar"`
Status bool `bson:"status" json:"status"`
Trends []string `bson:"trends" json:"trends"`
}
Computations struct holds information about what needs to be computed in this report e.g. a/r, status and specific trends
type Info ¶
type Info struct {
Name string `bson:"name,omitempty" json:"name" xml:"name"`
Description string `bson:"description,omitempty" json:"description" xml:"description"`
Created string `bson:"created,omitempty" json:"created,omitempty" xml:"created,omitempty"`
Updated string `bson:"updated,omitempty" json:"updated,omitempty" xml:"updated,omitempty"`
}
Info contains info about a report and is used inside the main MongoInterface struct
type MongoInterface ¶
type MongoInterface struct {
ID string `bson:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
Tenant string `json:"tenant" xml:"tenant"`
Weight string `bson:"weight,omitempty" json:"weight,omitempty" xml:"weight,omitempty"`
Disabled bool `bson:"disabled" json:"disabled" xml:"disabled"`
Info Info `bson:"info" json:"info" xml:"info"`
Computations *Computations `bson:"computations" json:"computations" xml:"-"`
Thresholds *Thresholds `bson:"thresholds,omitempty" json:"thresholds,omitempty" xml:"thresholds"`
Topology Topology `bson:"topology_schema" json:"topology_schema" xml:"topology_schema"`
Profiles []Profile `bson:"profiles" json:"profiles" xml:"profiles"`
Tags []Tag `bson:"filter_tags" json:"filter_tags" xml:"filter_tags"`
}
MongoInterface is used as an interface to Marshal and Unmarshal from different formats
func (MongoInterface) DetermineGroupType ¶
func (report MongoInterface) DetermineGroupType(groupType string) string
DetermineGroupType looks into a report struct topology group pointers and determines whether a given groupType is a lesser_group or group or does not exist in the report.
func (MongoInterface) GetEndpointGroupType ¶
func (report MongoInterface) GetEndpointGroupType() string
GetEndpointGroupType retrieves the deepest type nested inside the group hierarchy
func (MongoInterface) GetGroupType ¶
func (report MongoInterface) GetGroupType() string
GetGroupType retrieves the first type nested inside the group hierarchy
func (*MongoInterface) ValidateProfiles ¶
func (report *MongoInterface) ValidateProfiles(db *mongo.Database) []respond.ErrorResponse
ValidateProfiles ensures that the profiles in a report actually exist in the database and corrects possible name inconsistencies
func (*MongoInterface) ValidateTrends ¶
func (report *MongoInterface) ValidateTrends() []respond.ErrorResponse
type Profile ¶
type Profile struct {
XMLName xml.Name `bson:"-" json:"-" xml:"profile"`
ID string `bson:"id" json:"id" xml:"id,attr"`
Name string `bson:"name" json:"name" xml:"name,attr"`
Type string `bson:"type" json:"type" xml:"type,attr"`
}
Profile holds info about the profiles included in a report definition
type Tag ¶
type Tag struct {
XMLName xml.Name `bson:",omitempty" json:"-" xml:"tag"`
Name string `bson:"name" json:"name" xml:"name,attr"`
Value string `bson:"value" json:"value" xml:"value,attr"`
Context string `bson:"context" json:"context" xml:"context,attr"`
}
Tag holds info about the tags used in filtering in a report definition
type Thresholds ¶
type Thresholds struct {
Availabilty float32 `bson:"availability" json:"availability" xml:"availability"`
Reliability float32 `bson:"reliability" json:"reliability" xml:"reliability"`
Uptime float32 `bson:"uptime" json:"uptime" xml:"uptime"`
Unknown float32 `bson:"unknown" json:"unknown" xml:"unknown"`
Downtime float32 `bson:"downtime" json:"downtime" xml:"downtime"`
}
Thresholds contains information about the percentage thresholds used to color report scores
type Topology ¶
type Topology struct {
// Nesting int `bson:"nesting" json:"nesting" xml:"nesting"`
Group *TopologyLevel `bson:"group,omitempty" json:"group,omitempty" xml:"group,omitempty"`
}
Topology contains the topology used in this report and is used inside the main MongoInterface struct
type TopologyLevel ¶
type TopologyLevel struct {
Type string `bson:"type" json:"type" xml:"type"`
Group *TopologyLevel `bson:"group,omitempty" json:"group,omitempty" xml:"group,omitempty"`
}
TopologyLevel is used to create the multiple nesting levels for the Topology struct