Sha256: 30be23152760a23eed202c9e755ea0ffec14138dd38205471d330db680e5d871

Contents?: true

Size: 767 Bytes

Versions: 2

Compression:

Stored size: 767 Bytes

Contents

package flapjack

import "errors"

// Event is a basic representation of a Flapjack event.
// Find more at http://flapjack.io/docs/1.0/development/DATA_STRUCTURES
type Event struct {
	Entity	string `json:"entity"`
	Check	string `json:"check"`
	Type	string `json:"type"`
	State	string `json:"state"`
	Summary	string `json:"summary"`
	Time	int64  `json:"time"`
}

// IsValid performs basic validations on the event data.
func (e Event) IsValid() (error) {
	// FIXME(auxesis): provide validation errors for each failure
	if len(e.Entity)  == 0 { return errors.New("no entity") }
	if len(e.Check)   == 0 { return errors.New("no check") }
	if len(e.State)   == 0 { return errors.New("no state") }
	if len(e.Summary) == 0 { return errors.New("no summary") }
	return nil
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flapjack-1.0.0rc6 src/flapjack/event.go
flapjack-1.0.0rc5 src/flapjack/event.go