diff --git a/cachet/component.go b/cachet/component.go index c194f54..f9090f2 100644 --- a/cachet/component.go +++ b/cachet/component.go @@ -4,7 +4,7 @@ import ( "time" ) -// Cachet component model +// Component Cachet model type Component struct { ID int `json:"id"` Name string `json:"name"` @@ -12,7 +12,7 @@ type Component struct { Status int `json:"status"` Link *string `json:"link"` Order *int `json:"order"` - GroupId *int `json:"group_id"` + GroupID *int `json:"group_id"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` DeletedAt *time.Time `json:"deleted_at"` diff --git a/cachet/config.go b/cachet/config.go index 285df53..8ccd1bd 100644 --- a/cachet/config.go +++ b/cachet/config.go @@ -13,7 +13,7 @@ import ( // Static config var Config CachetConfig -// Monitoring tool configuration +// CachetConfig is the monitoring tool configuration type CachetConfig struct { APIUrl string `json:"api_url"` APIToken string `json:"api_token"` diff --git a/cachet/incident.go b/cachet/incident.go index da74e1c..141c877 100644 --- a/cachet/incident.go +++ b/cachet/incident.go @@ -6,7 +6,7 @@ import ( "encoding/json" ) -// Cachet Incident data model +// Incident Cachet data model type Incident struct { ID int `json:"id"` Name string `json:"name"` @@ -14,22 +14,22 @@ type Incident struct { Status int `json:"status"`// 4? HumanStatus string `json:"human_status"` Component *Component `json:"component"` - ComponentId *int `json:"component_id"` + ComponentID *int `json:"component_id"` CreatedAt int `json:"created_at"` UpdatedAt int `json:"updated_at"` } -// Response when creating/updating an incident +// IncidentData is a response when creating/updating an incident type IncidentData struct { Incident Incident `json:"data"` } -// from API /incidents +// IncidentList - from API /incidents type IncidentList struct { Incidents []Incident `json:"data"` } -// Get list of incidents +// GetIncidents - Get list of incidents func GetIncidents() []Incident { _, body, err := makeRequest("GET", "/incidents", nil) if err != nil { @@ -45,7 +45,7 @@ func GetIncidents() []Incident { return data.Incidents } -// Create or Update incident +// Send - Create or Update incident func (incident *Incident) Send() { jsonBytes, err := json.Marshal(incident) if err != nil { @@ -83,7 +83,7 @@ func (incident *Incident) Send() { } // Get the same incident. -// Updates incident.ID +// GetSimilarIncidentId Updates incident.ID func (incident *Incident) GetSimilarIncidentId() { incidents := GetIncidents() @@ -96,25 +96,25 @@ func (incident *Incident) GetSimilarIncidentId() { } } -// Set status to Investigating +// SetInvestigating sets status to Investigating func (incident *Incident) SetInvestigating() { incident.Status = 1 incident.HumanStatus = "Investigating" } -// Set status to Identified +// SetIdentified sets status to Identified func (incident *Incident) SetIdentified() { incident.Status = 2 incident.HumanStatus = "Identified" } -// Set status to Watching +// SetWatching sets status to Watching func (incident *Incident) SetWatching() { incident.Status = 3 incident.HumanStatus = "Watching" } -// Set status to Fixed +// SetFixed sets status to Fixed func (incident *Incident) SetFixed() { incident.Status = 4 incident.HumanStatus = "Fixed" diff --git a/cachet/metrics.go b/cachet/metrics.go index 44f0142..7a3d9e2 100644 --- a/cachet/metrics.go +++ b/cachet/metrics.go @@ -6,7 +6,7 @@ import ( "encoding/json" ) -// Send lag metric point +// SendMetric sends lag metric point func SendMetric(metricID int, delay int64) { if metricID <= 0 { return diff --git a/cachet/monitor.go b/cachet/monitor.go index 99bc790..61a41ae 100644 --- a/cachet/monitor.go +++ b/cachet/monitor.go @@ -55,7 +55,7 @@ func (monitor *Monitor) doRequest() bool { return resp.StatusCode == monitor.ExpectedStatusCode } -// Decides if the monitor is statistically up or down and creates / resolves an incident +// AnalyseData decides if the monitor is statistically up or down and creates / resolves an incident func (monitor *Monitor) AnalyseData() { // look at the past few incidents numDown := 0