This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1489 from kindermoumoute/refactor_API
Refactor api and add v2 API (beta)
- Loading branch information
Showing
55 changed files
with
3,991 additions
and
1,426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.