Documentation ¶
Index ¶
- Constants
- Variables
- func Router() *mux.Router
- func RouterWithPrefix(prefix string) *mux.Router
- func ServeJSON(w http.ResponseWriter, data interface{}) error
- type BodyFormat
- type Condition
- type ContainerEvent
- type ContainerEventType
- type ContainerField
- type ContainerInfo
- type ContainerState
- type Criteria
- type EventType
- type Hook
- type HostInfo
- type ModifyHookRequest
- type NewHookRequest
- type Operand
- type Reaction
- type StateChange
- type URLBuilder
Constants ¶
View Source
const ( RouteNameBase = "base" RouteNameHooks = "hooks" RouteNameHook = "hook" )
View Source
const ErrorGroup = "csense.api.v1"
Variables ¶
View Source
var API = struct { Routes []describe.Route `json:"routes"` }{ Routes: routeDescriptors, }
View Source
var ( ErrorCodeHookUnknown = errcode.Register(ErrorGroup, errcode.ErrorDescriptor{ Value: "HOOK_UNKNOWN", Message: "hook not known to server", Description: "This is returned if the hook ID used during an operation is unknown to the server.", HTTPStatusCode: http.StatusNotFound, }) )
View Source
var (
IDRegex = regexp.MustCompile(`(?i)[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}`)
)
Functions ¶
func RouterWithPrefix ¶
func ServeJSON ¶
func ServeJSON(w http.ResponseWriter, data interface{}) error
Types ¶
type BodyFormat ¶
type BodyFormat string
var ( FormatNone BodyFormat FormatJSON BodyFormat = "json" FormatSlackJSON BodyFormat = "json+slack" )
type ContainerEvent ¶
type ContainerEvent struct { Type ContainerEventType `json:"type"` Container *ContainerInfo `json:"container"` Timestamp int64 `json:"timestamp"` }
type ContainerEventType ¶
type ContainerEventType string
const ( EventContainerCreation ContainerEventType = "containerCreation" EventContainerDeletion ContainerEventType = "containerDeletion" EventContainerOom ContainerEventType = "oom" EventContainerOomKill ContainerEventType = "oomKill" EventContainerExisted ContainerEventType = "containerExisted" )
type ContainerField ¶
type ContainerField string
var ( FieldName ContainerField = "name" FieldImageName ContainerField = "image_name" )
type ContainerInfo ¶
type ContainerState ¶
type ContainerState string
const ( StateRunning ContainerState = "running" StateStopped ContainerState = "stopped" StateUnknown ContainerState = "unknown" )
func StateFromEvent ¶
func StateFromEvent(eventType ContainerEventType) ContainerState
type Criteria ¶
type Criteria struct { Fields map[ContainerField]*Condition Labels map[string]string `json:"labels,omitempty"` }
type ModifyHookRequest ¶
type NewHookRequest ¶
type Reaction ¶
type Reaction struct { Timestamp int64 `json:"timestamp"` Hook *Hook `json:"hook"` Host *HostInfo `json:"host"` Container *ContainerInfo `json:"container"` }
type StateChange ¶
type StateChange struct { State ContainerState `json:"state"` Source *ContainerEvent `json:"source_event"` Container *ContainerInfo `json:"container"` }
type URLBuilder ¶
type URLBuilder struct {
// contains filtered or unexported fields
}
func NewURLBuilder ¶
func NewURLBuilder(root *url.URL, relative bool) *URLBuilder
func NewURLBuilderFromRequest ¶
func NewURLBuilderFromRequest(r *http.Request, relative bool) *URLBuilder
func NewURLBuilderFromString ¶
func NewURLBuilderFromString(root string, relative bool) (*URLBuilder, error)
func (*URLBuilder) BuildBaseURL ¶
func (ub *URLBuilder) BuildBaseURL() (string, error)
func (*URLBuilder) BuildHooks ¶
func (ub *URLBuilder) BuildHooks() (string, error)
Click to show internal directories.
Click to hide internal directories.