diff --git a/mgmt/rest/api/api.go b/mgmt/rest/api/api.go new file mode 100644 index 000000000..1b85a902d --- /dev/null +++ b/mgmt/rest/api/api.go @@ -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 +} diff --git a/mgmt/rest/api/config.go b/mgmt/rest/api/config.go new file mode 100644 index 000000000..f45c05028 --- /dev/null +++ b/mgmt/rest/api/config.go @@ -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 +} diff --git a/mgmt/rest/api/metric.go b/mgmt/rest/api/metric.go new file mode 100644 index 000000000..503fb97ee --- /dev/null +++ b/mgmt/rest/api/metric.go @@ -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 +} diff --git a/mgmt/rest/api/task.go b/mgmt/rest/api/task.go new file mode 100644 index 000000000..baab427d0 --- /dev/null +++ b/mgmt/rest/api/task.go @@ -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) +} diff --git a/mgmt/rest/api/tribe.go b/mgmt/rest/api/tribe.go new file mode 100644 index 000000000..662f248d4 --- /dev/null +++ b/mgmt/rest/api/tribe.go @@ -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 +}