models

package
v0.0.0-...-dc9cd6f Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// IncidentStatusOK means "This status is fully operational."
	IncidentStatusOK = 1
	// IncidentStatusUnstable means "You received reports of a problem."
	IncidentStatusUnstable = 2
	// IncidentStatusOutage means "A severe problem happened"
	IncidentStatusOutage = 3
)
View Source
const (
	// WebhookIncomingType identify webhook incoming type
	WebhookIncomingType = "incoming"
	// WebhookOutgoingType identify webhook outgoing type
	WebhookOutgoingType = "outgoing"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Ref       string   `json:"ref,omitempty"`
	Name      string   `json:"name" binding:"required"`
	Resources []string `json:"resource_refs"`
}

Client is a structure that identify a group of resources by a name

type Component

type Component struct {
	Ref     string   `json:"ref,omitempty"`
	Name    string   `json:"name" binding:"required"`
	Labels  []string `json:"labels,omitempty"`
	Address string   `json:"address"`
}

Component represents a server, database, application or any resource that will be monitored

type ComponentLabels

type ComponentLabels struct {
	Labels []string `json:"labels,omitempty" binding:"required"`
}

ComponentLabels is a convenience structure that identifies an list of Component by labels

type ComponentRefs

type ComponentRefs struct {
	Refs []string `json:"refs,omitempty"`
}

ComponentRefs is a convenience structure that identifies an list of Component references

type Incident

type Incident struct {
	Status       int           `json:"status" binding:"required"`
	Resolved     bool          `json:"resolved"`
	Description  string        `json:"description,omitempty"`
	Date         time.Time     `json:"occurrence_date" binding:"required"`
	Duration     time.Duration `json:"duration"`
	ComponentRef string        `json:"component_ref" bson:"component_ref" binding:"required"`
}

Incident represents some event categorized by one of three possible status

type ListIncidentQueryParameters

type ListIncidentQueryParameters struct {
	StartDate  string
	EndDate    string
	Unresolved bool
}

ListIncidentQueryParameters is a convenience structure that bags the query parameters of ListIncidentEndpoint

type LogFields

type LogFields map[string]interface{}

type PrometheusAlerts

type PrometheusAlerts struct {
	Status          string          `json:"status"`
	PrometheusLabel PrometheusLabel `json:"labels,omitempty" binding:"required"`
	Component       Component       `json:"annotations,omitempty" binding:"required"`
	StartsAt        time.Time       `json:"startsAt,omitempty"`
	EndsAt          time.Time       `json:"endsAt"`
	GeneratorURL    string          `json:"generatorURL,omitempty"`
}

PrometheusAlerts represents a special structure of Alert generated by Prometheus rules

type PrometheusIncomingWebhook

type PrometheusIncomingWebhook struct {
	Alerts []PrometheusAlerts `json:"alerts" binding:"required"`
}

PrometheusIncomingWebhook is the payload sent from the Prometheus AlertManager

type PrometheusLabel

type PrometheusLabel struct {
	Status       string    `json:"status" binding:"required"`
	Description  string    `json:"description"`
	Date         time.Time `json:"occurrence_date" binding:"required"`
	ComponentRef string    `json:"component_ref" binding:"required"`
}

PrometheusLabel is a structure created to be carried in the PrometheusAlerts with the Incident information

type Webhook

type Webhook struct {
	ID          bson.ObjectId `json:"id" bson:"_id,omitempty"` //
	Type        string        `json:"type"`                    // Incoming || Outgoing types
	Enabled     bool          `json:"enabled"`                 //
	Token       string        `json:"token,omitempty"`         // Incoming: the endpoint Identification || Outgoing: Any
	Name        string        `json:"name"`                    // Shared
	Description string        `json:"description,omitempty"`   // Shared
	Target      string        `json:"url,omitempty"`           // Outgoing destination
	Trigger     string        `json:"trigger,omitempty"`       // Outgoing activation
	Payload     interface{}   `json:"data"`                    // Shared
}

Webhook is the definition of both a Incoming and Outgoing webhook

Jump to

Keyboard shortcuts

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