models

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2018 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Endpoints = "endpoints"
	Schedules = "schedules"
	Rules     = "rules"
	Reports   = "reports"
	Errors    = "errors"
)

MongoDB Collections

Variables

View Source
var States = map[State]string{
	Initial:  "Initial",
	Running:  "Running",
	Finished: "Finished",
	Failed:   "Failed",
}

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	ID            bson.ObjectId `bson:"_id,omitempty"  json:"-"`
	ULID          string        `bson:"ulid"           json:"ulid"`
	Hostname      string        `bson:"hostame"        json:"hostname"`
	ClientVersion string        `bson:"client_version" json:"client_version"`
	Tags          []string      `bson:"tags"           json:"tags"`
	LastPing      time.Time     `bson:"last_ping"      json:"last_ping"`
	CreateAt      time.Time     `bson:"created_at"     json:"created_at"`
	UpdateAt      time.Time     `bson:"updated_at"     json:"updated_at"`
}

Endpoint collection

type Error

type Error struct {
	ID          bson.ObjectId `bson:"_id,omitempty"  json:"-"`
	ULID        string        `bson:"ulid"           json:"ulid"`
	TaskID      string        `bson:"task_id"        json:"task_id"`
	ErrorID     errors.Error  `bson:"error_id"       json:"error_id"`
	ErrorMsg    string        `bson:"error_msg"      json:"error_msg"`
	Acknowledge bool          `bson:"acknowledge"    json:"acknowledge"`
	CreateAt    time.Time     `bson:"created_at"     json:"created_at"`
	UpdateAt    time.Time     `bson:"updated_at"     json:"updated_at"`
}

Error collection

type LReports

type LReports struct {
	ReportID string    `bson:"report_id"   json:"report_id"`
	Task     Task      `bson:"task"        json:"task"`
	Result   []Result  `bson:"result"      json:"result"`
	CreateAt time.Time `bson:"created_at"  json:"created_at"`
	UpdateAt time.Time `bson:"updated_at"  json:"updated_at"`
}

type Report

type Report struct {
	ID       bson.ObjectId `bson:"_id,omitempty"  json:"-"`
	ULID     string        `bson:"ulid"           json:"ulid"`
	Reports  []LReports    `bson:"reports"        json:"reports"`
	CreateAt time.Time     `bson:"created_at"     json:"created_at"`
	UpdateAt time.Time     `bson:"updated_at"     json:"updated_at"`
}

Report collection

type Result

type Result struct {
	File      string                 `bson:"file"       json:"file"`
	RuleName  string                 `bson:"rule_name"  json:"rule_name"`
	Namespace string                 `bson:"namespace"  json:"namespace"`
	Tags      []string               `bson:"tags"       json:"tags"`
	Meta      map[string]interface{} `bson:"meta"       json:"meta"`
	Strings   []String               `bson:"strings"    json:"strings"`
}

type Rule

type Rule struct {
	ID       bson.ObjectId `bson:"_id,omitempty"  json:"-"`
	RuleID   string        `bson:"rule_id"        json:"rule_id"`
	Name     string        `bson:"name"           json:"name"`
	Tags     []string      `bson:"tags"           json:"tags"`
	Data     string        `bson:"data"           json:"data"`
	CreateAt time.Time     `bson:"created_at"     json:"created_at"`
	UpdateAt time.Time     `bson:"updated_at"     json:"updated_at"`
}

Rule collection

type Schedule

type Schedule struct {
	ID       bson.ObjectId `bson:"_id,omitempty" json:"-"`
	ULID     string        `bson:"ulid"          json:"ulid"`
	Tasks    []Task        `bson:"tasks"         json:"tasks"`
	CreateAt time.Time     `bson:"created_at"    json:"created_at"`
	UpdateAt time.Time     `bson:"updated_at"    json:"updated_at"`
}

Schedule collection

type State

type State int

Task states

const (
	Initial State = iota
	Running
	Finished
	Failed
)

type String

type String struct {
	Name   string `bson:"name"    json:"name"`
	Offset uint64 `bson:"offset"  json:"offset"`
}

type Task

type Task struct {
	TaskID   string          `bson:"task_id"     json:"task_id"`
	Command  command.Command `bson:"command"     json:"command"`
	Rules    []bson.ObjectId `bson:"rules"       json:"rules"`
	Params   string          `bson:"params"      json:"params"`
	When     time.Time       `bson:"when"        json:"when"`
	Status   State           `bson:"status"      json:"status"`
	CreateAt time.Time       `bson:"created_at"  json:"created_at"`
	UpdateAt time.Time       `bson:"updated_at"  json:"updated_at"`
}

Task type

Jump to

Keyboard shortcuts

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