api

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2016 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SESSION_HEADER_NAME   = "BANG_SESSION"
	EXPIRED_SESSION_TOKEN = 4000
	INVALID_SESSION_TOKEN = 4001
)

Variables

View Source
var (
	GlobalSession       *Session
	InvalidSessionToken = errors.New("Invalid Session Token")
	ExpiredSessionToken = errors.New("Session Token Expired")
)
View Source
var (
	MUST_INCLUDE_ID = errors.New("Must include id")
)

Functions

func GetTag added in v0.15.0

func GetTag(w http.ResponseWriter, r *http.Request) (kv event.KeyVal)

Types

type AuthUser added in v0.15.0

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

AuthUser handles the api methods for incidents

func NewAuthUser added in v0.15.0

func NewAuthUser(pipe *pipeline.Pipeline) *AuthUser

NewAuthUser Create a new AuthUser api method

func (*AuthUser) EndPoint added in v0.15.0

func (c *AuthUser) EndPoint() string

EndPoint return the endpoint of this method

func (*AuthUser) Get added in v0.15.0

func (c *AuthUser) Get(req *Request)

Get HTTP get method

type ConfigHash

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

ConfigHash handles the api methods for incidents

func NewConfigHash

func NewConfigHash(pipe *pipeline.Pipeline) *ConfigHash

NewConfigHash Create a new ConfigHash api method

func (*ConfigHash) EndPoint

func (c *ConfigHash) EndPoint() string

EndPoint return the endpoint of this method

func (*ConfigHash) Get

func (c *ConfigHash) Get(w http.ResponseWriter, r *http.Request)

Get HTTP get method

type ConfigVersion added in v0.15.0

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

ConfigVersion handles the api methods for incidents

func NewConfigVersion added in v0.15.0

func NewConfigVersion(pipe *pipeline.Pipeline) *ConfigVersion

NewConfigVersion Create a new ConfigVersion api method

func (*ConfigVersion) EndPoint added in v0.15.0

func (c *ConfigVersion) EndPoint() string

EndPoint return the endpoint of this method

func (*ConfigVersion) Get added in v0.15.0

func (c *ConfigVersion) Get(req *Request)

Get HTTP get method

func (*ConfigVersion) Post added in v0.15.0

func (c *ConfigVersion) Post(req *Request)

change the current config to a spesific version

type Delete added in v0.15.0

type Delete RequestHandler

func (Delete) NeedsAuth added in v0.15.0

func (d Delete) NeedsAuth() config.UserPermissions

type Deleter

type Deleter interface {
	Delete(*Request)
}

A Deleter provides an http "DELETE" method

type EndPointer

type EndPointer interface {
	EndPoint() string
}

An EndPointer returns the end point for this method

type EscalationConfig added in v0.15.0

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

EscalationConfig handles the api methods for incidents

func NewEscalationConfig added in v0.15.0

func NewEscalationConfig(pipe *pipeline.Pipeline) *EscalationConfig

func (*EscalationConfig) Delete added in v0.15.0

func (p *EscalationConfig) Delete(req *Request)

Delete the given event provider

func (*EscalationConfig) EndPoint added in v0.15.0

func (p *EscalationConfig) EndPoint() string

EndPoint return the endpoint of this method

func (*EscalationConfig) Get added in v0.15.0

func (p *EscalationConfig) Get(req *Request)

Get HTTP get method

func (*EscalationConfig) Post added in v0.15.0

func (p *EscalationConfig) Post(req *Request)

Post HTTP get method

type EventStats

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

handles the api methods for incidents

func NewEventStats

func NewEventStats(pipe *pipeline.Pipeline) *EventStats

func (*EventStats) EndPoint

func (e *EventStats) EndPoint() string

func (*EventStats) Get

func (e *EventStats) Get(req *Request)

type Get added in v0.15.0

type Get RequestHandler

func (Get) NeedsAuth added in v0.15.0

func (g Get) NeedsAuth() config.UserPermissions

type GetUserResponse added in v0.15.0

type GetUserResponse struct {
	UserName    string `json:"user_name"`
	Name        string `json:"name"`
	Permissions string `json:"permissions"`
}

type Getter

type Getter interface {
	Get(*Request)
}

A Getter provides an http "GET" method

type HashResponse

type HashResponse struct {
	Hash      string `json:"hash"`
	Timestamp int64  `json:"time"`
}

HashResponse will be marshaled as json as the successful response

type Incident

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

handles the api methods for incidents

func NewIncident

func NewIncident(p *pipeline.Pipeline) *Incident

func (*Incident) Delete added in v0.15.0

func (i *Incident) Delete(req *Request)

Delete will resolve a given event

func (*Incident) EndPoint

func (i *Incident) EndPoint() string

func (*Incident) Get added in v0.15.0

func (i *Incident) Get(req *Request)

func (*Incident) Post

func (i *Incident) Post(req *Request)

Create an incident

type NeedsAuther added in v0.15.0

type NeedsAuther interface {
	NeedsAuth() config.UserPermissions
}

type NewUserRequest added in v0.15.0

type NewUserRequest struct {
	UserName string `json:"user_name"`
	Name     string `json:"name"`
	Password string `json:"password"`
}

type PolicyConfig added in v0.15.0

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

PolicyConfig handles the api methods for incidents

func NewPolicyConfig added in v0.15.0

func NewPolicyConfig(pipe *pipeline.Pipeline) *PolicyConfig

func (*PolicyConfig) Delete added in v0.15.0

func (p *PolicyConfig) Delete(req *Request)

Delete the given event provider

func (*PolicyConfig) EndPoint added in v0.15.0

func (p *PolicyConfig) EndPoint() string

EndPoint return the endpoint of this method

func (*PolicyConfig) Get added in v0.15.0

func (p *PolicyConfig) Get(req *Request)

Get HTTP get method

func (*PolicyConfig) Post added in v0.15.0

func (p *PolicyConfig) Post(req *Request)

Post HTTP get method

type Post added in v0.15.0

type Post RequestHandler

func (Post) NeedsAuth added in v0.15.0

func (p Post) NeedsAuth() config.UserPermissions

type Poster

type Poster interface {
	Post(*Request)
}

A Poster provides an http "POST" method

type ProviderConfig added in v0.15.0

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

ProviderConfig handles the api methods for incidents

func NewProviderConfig added in v0.15.0

func NewProviderConfig(pipe *pipeline.Pipeline) *ProviderConfig

func (*ProviderConfig) Delete added in v0.15.0

func (p *ProviderConfig) Delete(req *Request)

Delete the given event provider

func (*ProviderConfig) EndPoint added in v0.15.0

func (c *ProviderConfig) EndPoint() string

EndPoint return the endpoint of this method

func (*ProviderConfig) Get added in v0.15.0

func (c *ProviderConfig) Get(req *Request)

Get HTTP get method

func (*ProviderConfig) Post added in v0.15.0

func (c *ProviderConfig) Post(req *Request)

Post HTTP get method

type Put added in v0.15.0

type Put RequestHandler

func (Put) NeedsAuth added in v0.15.0

func (p Put) NeedsAuth() config.UserPermissions

type Putter added in v0.15.0

type Putter interface {
	Put(*Request)
}

A Putter provides an http "POST" method

type Request added in v0.15.0

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

type RequestHandler added in v0.15.0

type RequestHandler func(*Request)

type Server

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

Server Serves the http api for bangarang

func NewServer

func NewServer(port int, pipe *pipeline.Pipeline) *Server

NewServer creates and returns a new server

func (*Server) Serve

func (s *Server) Serve() error

Serve the bangarang api via HTTP

type Session added in v0.15.0

type Session struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSession added in v0.15.0

func NewSession() *Session

func (*Session) Delete added in v0.15.0

func (s *Session) Delete(token string)

Delete the token from the session store

func (*Session) Get added in v0.15.0

func (s *Session) Get(token string) (string, error)

Get a User.UserName from the session store that corrospondes with the session token

func (*Session) Put added in v0.15.0

func (s *Session) Put(userName string) string

Put a new session token into the store for the given user id, and return the token

type SessionToken added in v0.15.0

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

func NewSessionToken added in v0.15.0

func NewSessionToken(userName string) SessionToken

NewSessionToken create a unique session token for the given user id

type SystemStats added in v0.15.0

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

handles the api methods for incidents

func NewSystemStats added in v0.15.0

func NewSystemStats(pipe *pipeline.Pipeline) *SystemStats

func (*SystemStats) EndPoint added in v0.15.0

func (e *SystemStats) EndPoint() string

func (*SystemStats) Get added in v0.15.0

func (e *SystemStats) Get(req *Request)

type Tag added in v0.15.0

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

handles the api methods for incidents

func NewTag added in v0.15.0

func NewTag(p *pipeline.Pipeline) *Tag

func (*Tag) Delete added in v0.15.0

func (t *Tag) Delete(w http.ResponseWriter, r *http.Request)

Delete will resolve a given event

func (*Tag) EndPoint added in v0.15.0

func (t *Tag) EndPoint() string

func (*Tag) Get added in v0.15.0

func (t *Tag) Get(w http.ResponseWriter, r *http.Request)

type User added in v0.15.0

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

User handles the api methods for incidents

func NewUser added in v0.15.0

func NewUser(pipe *pipeline.Pipeline) *User

NewUser Create a new User api method

func (*User) EndPoint added in v0.15.0

func (u *User) EndPoint() string

EndPoint return the endpoint of this method

func (*User) Get added in v0.15.0

func (u *User) Get(req *Request)

Get fetches information about the spesified user

func (*User) Post added in v0.15.0

func (u *User) Post(req *Request)

Post creates a new user

type UserPassword added in v0.15.0

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

UserPassword handles the api methods for incidents

func NewUserPassword added in v0.15.0

func NewUserPassword(pipe *pipeline.Pipeline) *UserPassword

NewUserPassword Create a new UserPassword api method

func (*UserPassword) EndPoint added in v0.15.0

func (u *UserPassword) EndPoint() string

EndPoint return the endpoint of this method

func (*UserPassword) Post added in v0.15.0

func (up *UserPassword) Post(req *Request)

Post changes the permissions for this user

type UserPermissions added in v0.15.0

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

UserPermissions handles the api methods for incidents

func NewUserPermissions added in v0.15.0

func NewUserPermissions(pipe *pipeline.Pipeline) *UserPermissions

NewUserPermissions Create a new UserPermissions api method

func (*UserPermissions) EndPoint added in v0.15.0

func (u *UserPermissions) EndPoint() string

EndPoint return the endpoint of this method

func (*UserPermissions) Post added in v0.15.0

func (up *UserPermissions) Post(req *Request)

Post changes the permissions for this user

Jump to

Keyboard shortcuts

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