Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Add API interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kindermoumoute committed Jan 24, 2017
1 parent 389d7fe commit 16da9b2
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mgmt/rest/api/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package api

import (
"github.com/julienschmidt/httprouter"
)

type API interface {
GetRoutes() []Route
BindMetricManager(Metrics)
BindTaskManager(Tasks)
BindTribeManager(Tribe)
BindConfigManager(Config)
}

type Route struct {
Method, Path string
Handle httprouter.Handle
}
15 changes: 15 additions & 0 deletions mgmt/rest/api/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package api

import (
"github.com/intelsdi-x/snap/core"
"github.com/intelsdi-x/snap/core/cdata"
)

type Config interface {
GetPluginConfigDataNode(core.PluginType, string, int) cdata.ConfigDataNode
GetPluginConfigDataNodeAll() cdata.ConfigDataNode
MergePluginConfigDataNode(pluginType core.PluginType, name string, ver int, cdn *cdata.ConfigDataNode) cdata.ConfigDataNode
MergePluginConfigDataNodeAll(cdn *cdata.ConfigDataNode) cdata.ConfigDataNode
DeletePluginConfigDataNodeField(pluginType core.PluginType, name string, ver int, fields ...string) cdata.ConfigDataNode
DeletePluginConfigDataNodeFieldAll(fields ...string) cdata.ConfigDataNode
}
18 changes: 18 additions & 0 deletions mgmt/rest/api/metric.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package api

import (
"github.com/intelsdi-x/snap/core"
"github.com/intelsdi-x/snap/core/serror"
)

type Metrics interface {
MetricCatalog() ([]core.CatalogedMetric, error)
FetchMetrics(core.Namespace, int) ([]core.CatalogedMetric, error)
GetMetricVersions(core.Namespace) ([]core.CatalogedMetric, error)
GetMetric(core.Namespace, int) (core.CatalogedMetric, error)
Load(*core.RequestedPlugin) (core.CatalogedPlugin, serror.SnapError)
Unload(core.Plugin) (core.CatalogedPlugin, serror.SnapError)
PluginCatalog() core.PluginCatalog
AvailablePlugins() []core.AvailablePlugin
GetAutodiscoverPaths() []string
}
19 changes: 19 additions & 0 deletions mgmt/rest/api/task.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package api

import (
"github.com/intelsdi-x/snap/core"
"github.com/intelsdi-x/snap/core/serror"
"github.com/intelsdi-x/snap/pkg/schedule"
"github.com/intelsdi-x/snap/scheduler/wmap"
)

type Tasks interface {
CreateTask(schedule.Schedule, *wmap.WorkflowMap, bool, ...core.TaskOption) (core.Task, core.TaskErrors)
GetTasks() map[string]core.Task
GetTask(string) (core.Task, error)
StartTask(string) []serror.SnapError
StopTask(string) []serror.SnapError
RemoveTask(string) error
WatchTask(string, core.TaskWatcherHandler) (core.TaskWatcherCloser, error)
EnableTask(string) (core.Task, error)
}
17 changes: 17 additions & 0 deletions mgmt/rest/api/tribe.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package api

import (
"github.com/intelsdi-x/snap/core/serror"
"github.com/intelsdi-x/snap/mgmt/tribe/agreement"
)

type Tribe interface {
GetAgreement(name string) (*agreement.Agreement, serror.SnapError)
GetAgreements() map[string]*agreement.Agreement
AddAgreement(name string) serror.SnapError
RemoveAgreement(name string) serror.SnapError
JoinAgreement(agreementName, memberName string) serror.SnapError
LeaveAgreement(agreementName, memberName string) serror.SnapError
GetMembers() []string
GetMember(name string) *agreement.Member
}

0 comments on commit 16da9b2

Please sign in to comment.