bot

package
v0.0.0-...-6cd4603 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	SlackWebhookURL string
	LogEntrySource  IncidentLogEntrySource
	Log             *logrus.Logger
}

func NewBot

func NewBot(log *logrus.Logger, projectID string, logName string, timezone string, webhookURL string) (*Bot, error)

func (*Bot) Run

func (b *Bot) Run(input string)

type BotService

type BotService struct {
	// contains filtered or unexported fields
}

func NewBotService

func NewBotService(cfg *config.Config, logger *logrus.Logger) (*BotService, error)

func (*BotService) JSONEndpoints

func (s *BotService) JSONEndpoints() map[string]map[string]server.JSONEndpoint

func (*BotService) JSONMiddleware

func (s *BotService) JSONMiddleware(j server.JSONEndpoint) server.JSONEndpoint

func (*BotService) Middleware

func (s *BotService) Middleware(h http.Handler) http.Handler

func (*BotService) Prefix

func (s *BotService) Prefix() string

type GCPLogAdmin

type GCPLogAdmin struct {
	ProjectID string
	LogName   string
	Timezone  string
}

func (*GCPLogAdmin) GetLogAdminFilter

func (g *GCPLogAdmin) GetLogAdminFilter(payload IncidentPayload) string

func (*GCPLogAdmin) GetLogEntries

func (g *GCPLogAdmin) GetLogEntries(payload IncidentPayload) ([]IncidentLogEntry, error)

type Incident

type Incident struct {
	IncidentID    string `json:"incident_id"`
	ResourceID    string `json:"resource_id"`
	ResourceName  string `json:"resource_name"`
	State         string `json:"state"`
	StartedAt     int64  `json:"started_at"`
	EndedAt       *int64 `json:"ended_at"`
	PolicyName    string `json:"policy_name"`
	ConditionName string `json:"condition_name"`
	URL           string `json:"url"`
	Summary       string `json:"summary"`
}

func (*Incident) EndedAtTime

func (i *Incident) EndedAtTime() string

func (*Incident) StartedAtTime

func (i *Incident) StartedAtTime() string

type IncidentLogEntry

type IncidentLogEntry struct {
	EventTime    time.Time
	Environment  string
	ResourceID   string
	ResourceName string
	Description  string
	Error        string
	Caller       string
	Service      string
}

type IncidentLogEntrySource

type IncidentLogEntrySource interface {
	GetLogAdminFilter(payload IncidentPayload) string
	GetLogEntries(payload IncidentPayload) ([]IncidentLogEntry, error)
}

type IncidentPayload

type IncidentPayload struct {
	Incident Incident
	Version  string
}

func (*IncidentPayload) Populate

func (i *IncidentPayload) Populate(input string) error

Jump to

Keyboard shortcuts

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