This commit is contained in:
crusader 2017-12-04 15:50:11 +09:00
parent a0c0fefa8d
commit 3f116f1343
12 changed files with 72 additions and 58 deletions

View File

@ -1,53 +1,11 @@
package model package model
type Connection struct { import "encoding/json"
IP string `json:"ip,omitempty"`
Port string `json:"port,omitempty"`
PortType string `json:"portType,omitempty"`
SSL bool `json:"ssl,omitempty"`
}
type Target struct {
Auth map[string]interface{} `json:"auth,omitempty"`
Connection Connection `json:"connection,omitempty"`
}
type Schedule struct {
Interval string `json:"interval,omitempty"`
}
type Keys struct {
Metric string `json:"metric,omitempty"`
Key string `json:"key,omitempty"`
}
type QueryInfo struct {
Query string `json:"query,omitempty"`
Extend map[string]interface{} `json:"extend,omitempty"`
}
type MappingInfo struct {
ParseDirection string `json:"parseDirection,omitempty"`
ArrayColumns []string `json:"arrayColumns,omitempty"`
KeyColumns []string `json:"keyColumns,omitempty"`
ValueColumn string `json:"valueColumn,omitempty"`
}
type Item struct {
Keys []Keys `json:"keys,omitempty"`
QueryInfo QueryInfo `json:"queryInfo,omitempty"`
MappingInfo MappingInfo `json:"mappingInfo,omitempty"`
}
type Crawler struct {
Name string `json:"name,omitempty"`
Container string `json:"container,omitempty"`
}
type Config struct { type Config struct {
ID string `json:"id,omitempty"` ID json.Number `json:"id,Number,omitempty"`
Target Target `json:"target,omitempty"` Target *Target `json:"target,omitempty"`
Schedule Schedule `json:"schedule,omitempty"` Schedule *Schedule `json:"schedule,omitempty"`
Crawler Crawler `json:"crawler,omitempty"` Crawler *Crawler `json:"crawler,omitempty"`
Items []Item `json:"items,omitempty"` Items []Item `json:"items,omitempty"`
} }

View File

@ -0,0 +1,8 @@
package model
type Connection struct {
IP string `json:"ip,omitempty"`
Port string `json:"port,omitempty"`
PortType string `json:"portType,omitempty"`
SSL bool `json:"ssl,omitempty"`
}

View File

@ -0,0 +1,6 @@
package model
type Crawler struct {
Name string `json:"name,omitempty"`
Container string `json:"container,omitempty"`
}

View File

@ -0,0 +1,7 @@
package model
type Item struct {
Keys []Keys `json:"keys,omitempty"`
QueryInfo *QueryInfo `json:"queryInfo,omitempty"`
MappingInfo *MappingInfo `json:"mappingInfo,omitempty"`
}

View File

@ -0,0 +1,6 @@
package model
type Keys struct {
Metric string `json:"metric,omitempty"`
Key string `json:"key,omitempty"`
}

View File

@ -0,0 +1,8 @@
package model
type MappingInfo struct {
ParseDirection string `json:"parseDirection,omitempty"`
ArrayColumns []string `json:"arrayColumns,omitempty"`
KeyColumns []string `json:"keyColumns,omitempty"`
ValueColumn string `json:"valueColumn,omitempty"`
}

View File

@ -0,0 +1,6 @@
package model
type QueryInfo struct {
Query string `json:"query,omitempty"`
Extend map[string]interface{} `json:"extend,omitempty"`
}

View File

@ -0,0 +1,5 @@
package model
type Schedule struct {
Interval string `json:"interval,omitempty"`
}

View File

@ -0,0 +1,6 @@
package model
type Target struct {
Auth map[string]interface{} `json:"auth,omitempty"`
Connection *Connection `json:"connection,omitempty"`
}

View File

@ -1,9 +1,13 @@
package probe package probe
import (
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
)
type CrawlerService interface { type CrawlerService interface {
Install() Install()
Uninstall() Uninstall()
Update() Update()
Authenticate() Authenticate(crawler *configM.Crawler, target *configM.Target) (bool, error)
} }

View File

@ -1,4 +0,0 @@
package probe
type DiscoveryService interface {
}

View File

@ -1,9 +1,13 @@
package probe package probe
import (
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
)
type SensorService interface { type SensorService interface {
Start() Start(id int64) (bool, error)
Stop() Stop(id int64) (bool, error)
Add() Add(config *configM.Config) (bool, error)
Remove() Remove(id int64) (bool, error)
Update() Update(id int64) (bool, error)
} }