core

package
v0.0.0-...-40f30c5 Latest Latest
Warning

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

Go to latest
Published: May 5, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateFileFolder       = "cache"
	StateFileCharReplacer = "-"
)

Variables

View Source
var (
	StateFileRegex       = regexp.MustCompile(`[\/\?<>\\:\*\|":!\s.]`)
	StateFileRegexDashes = regexp.MustCompile(`--+`)
)

partly based on https://github.com/parshap/node-sanitize-filename/blob/master/index.js

Functions

func AccessLogger

func AccessLogger() restful.FilterFunction

func SetupSelfdiagnose

func SetupSelfdiagnose(app *restful.WebService)

Types

type Bot

type Bot interface {
	Name() string
	Description() string
	Help() Reply
	HandleMessage(*webhook.Request) Reply
	HandleConfig(*Wrangler, json.RawMessage) error
	CurrentState() []byte
}

Bot is the interface for the small bots used by the wrangler

type HipchatConfig

type HipchatConfig struct {
	URL         string `json:"url"`
	BotAuth     string `json:"bot_auth"`
	ScopeAuth   string `json:"scope_auth"`
	DefaultRoom string `json:"room_id"`
}

HipchatConfig is the struct used to marshall the "hipchat" part of the JSON configuration

type Reply

type Reply struct {
	Notification hipchat.NotificationRequest
	Replying     bool
}

func NewReply

func NewReply(n hipchat.NotificationRequest) Reply

func NoOpReply

func NoOpReply() Reply

type ReportBuildAndDate

type ReportBuildAndDate struct {
	Version string
	Date    string
}

func (ReportBuildAndDate) Comment

func (r ReportBuildAndDate) Comment() string

func (ReportBuildAndDate) Run

func (r ReportBuildAndDate) Run(ctx *selfdiagnose.Context, result *selfdiagnose.Result)

type ReportHTTPRequest

type ReportHTTPRequest struct{}

func (ReportHTTPRequest) Comment

func (r ReportHTTPRequest) Comment() string

func (ReportHTTPRequest) Run

func (r ReportHTTPRequest) Run(ctx *selfdiagnose.Context, result *selfdiagnose.Result)

type ReportHostname

type ReportHostname struct{}

func (ReportHostname) Comment

func (r ReportHostname) Comment() string

func (ReportHostname) Run

func (r ReportHostname) Run(ctx *selfdiagnose.Context, result *selfdiagnose.Result)

type Wrangler

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

Wrangler is the object that holds the configuration, HipChat client and has several general methods

func NewSnaketrap

func NewSnaketrap(fileName string) (*Wrangler, string, error)

NewSnaketrap reads the config.json and returns a bootstrapped Wrangler and listen address.

func (*Wrangler) GetBotConfig

func (w *Wrangler) GetBotConfig() json.RawMessage

func (*Wrangler) GetState

func (w *Wrangler) GetState(b Bot) ([]byte, error)

func (*Wrangler) SendNotification

func (w *Wrangler) SendNotification(b Bot, n *hipchat.NotificationRequest)

func (*Wrangler) SetState

func (w *Wrangler) SetState(b Bot) error

func (*Wrangler) SetTopic

func (w *Wrangler) SetTopic(b Bot, topic string)

Jump to

Keyboard shortcuts

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