Skip to content

Commit

Permalink
Merge pull request #73 from ripienaar/72
Browse files Browse the repository at this point in the history
(#72) add output action items
  • Loading branch information
ripienaar authored Dec 8, 2019
2 parents d4e9f3f + ee0863a commit f6553c8
Show file tree
Hide file tree
Showing 3 changed files with 338 additions and 79 deletions.
145 changes: 139 additions & 6 deletions backplane/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,19 @@ func AgentDDL() *agent.DDL {
Description: "Backplane communications test",
Display: "failed",
Input: make(map[string]*agent.ActionInputItem),
Output: make(map[string]*agent.ActionOutputItem),
Output: map[string]*agent.ActionOutputItem{
"version": &agent.ActionOutputItem{
Description: "The version of the Choria Backplane system in use",
DisplayAs: "Choria Backplane",
Type: "string",
},
},
Aggregation: []agent.ActionAggregateItem{
agent.ActionAggregateItem{
Function: "summary",
Arguments: json.RawMessage(`["version"]`),
},
},
}

ddl.Actions = append(ddl.Actions, act)
Expand All @@ -342,7 +354,75 @@ func AgentDDL() *agent.DDL {
Description: "Information about the managed service",
Display: "always",
Input: make(map[string]*agent.ActionInputItem),
Output: make(map[string]*agent.ActionOutputItem),
Output: map[string]*agent.ActionOutputItem{
"backplane_version": &agent.ActionOutputItem{
Description: "The version of the Choria Backplane system in use",
DisplayAs: "Choria Backplane",
Type: "string",
},

"version": &agent.ActionOutputItem{
Description: "Service Version",
DisplayAs: "Version",
Type: "string",
},

"healthy": &agent.ActionOutputItem{
Description: "Health Status",
DisplayAs: "Healthy",
Type: "boolean",
},

"loglevel": &agent.ActionOutputItem{
Description: "Active log level",
DisplayAs: "Log Level",
Type: "string",
},

"healthcheck_feature": &agent.ActionOutputItem{
Description: "If the HealthCheckable interface is used",
DisplayAs: "Health Feature",
Type: "boolean",
},

"pause_feature": &agent.ActionOutputItem{
Description: "If the Pausable interface is used",
DisplayAs: "Circuit Breaker Feature",
Type: "boolean",
},

"shutdown_feature": &agent.ActionOutputItem{
Description: "If the Stopable interface is used",
DisplayAs: "Shutdown Feature",
Type: "boolean",
},

"facts_feature": &agent.ActionOutputItem{
Description: "If the InfoSource interface is used",
DisplayAs: "Facts Feature",
Type: "boolean",
},

"loglevel_feature": &agent.ActionOutputItem{
Description: "If the LogLevelSetable interface is used",
DisplayAs: "Log Level Feature",
Type: "boolean",
},
},
Aggregation: []agent.ActionAggregateItem{
agent.ActionAggregateItem{
Function: "summary",
Arguments: json.RawMessage(`["version"]`),
},
agent.ActionAggregateItem{
Function: "summary",
Arguments: json.RawMessage(`["paused"]`),
},
agent.ActionAggregateItem{
Function: "summary",
Arguments: json.RawMessage(`["healthy"]`),
},
},
}

ddl.Actions = append(ddl.Actions, act)
Expand All @@ -352,7 +432,19 @@ func AgentDDL() *agent.DDL {
Description: "Terminates the managed service",
Display: "failed",
Input: make(map[string]*agent.ActionInputItem),
Output: make(map[string]*agent.ActionOutputItem),
Output: map[string]*agent.ActionOutputItem{
"delay": &agent.ActionOutputItem{
Description: "How long after running the action the shutdown will be initiated",
DisplayAs: "Delay",
Type: "string",
},
},
Aggregation: []agent.ActionAggregateItem{
agent.ActionAggregateItem{
Function: "summary",
Arguments: json.RawMessage(`["delay"]`),
},
},
}

ddl.Actions = append(ddl.Actions, act)
Expand All @@ -362,7 +454,24 @@ func AgentDDL() *agent.DDL {
Description: "Checks the health of the managed service",
Display: "failed",
Input: make(map[string]*agent.ActionInputItem),
Output: make(map[string]*agent.ActionOutputItem),
Output: map[string]*agent.ActionOutputItem{
"result": &agent.ActionOutputItem{
Description: "The result from the check method",
DisplayAs: "Result",
Type: "string",
},
"healthy": &agent.ActionOutputItem{
Description: "Status indicator for the checked service",
DisplayAs: "Healthy",
Type: "boolean",
},
},
Aggregation: []agent.ActionAggregateItem{
agent.ActionAggregateItem{
Function: "summary",
Arguments: json.RawMessage(`["healthy"]`),
},
},
}

ddl.Actions = append(ddl.Actions, act)
Expand All @@ -373,7 +482,19 @@ func AgentDDL() *agent.DDL {
Description: action,
Display: "always",
Input: make(map[string]*agent.ActionInputItem),
Output: make(map[string]*agent.ActionOutputItem),
Output: map[string]*agent.ActionOutputItem{
"paused": &agent.ActionOutputItem{
Description: "Circuit Breaker pause state",
DisplayAs: "Paused",
Type: "boolean",
},
},
Aggregation: []agent.ActionAggregateItem{
agent.ActionAggregateItem{
Function: "summary",
Arguments: json.RawMessage(`["paused"]`),
},
},
}

ddl.Actions = append(ddl.Actions, act)
Expand All @@ -385,7 +506,19 @@ func AgentDDL() *agent.DDL {
Description: action,
Display: "always",
Input: make(map[string]*agent.ActionInputItem),
Output: make(map[string]*agent.ActionOutputItem),
Output: map[string]*agent.ActionOutputItem{
"level": &agent.ActionOutputItem{
Description: "Log level that was activated",
DisplayAs: "Log Level",
Type: "string",
},
},
Aggregation: []agent.ActionAggregateItem{
agent.ActionAggregateItem{
Function: "summary",
Arguments: json.RawMessage(`["level"]`),
},
},
}

ddl.Actions = append(ddl.Actions, act)
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module github.com/choria-io/go-backplane

go 1.12
go 1.13

require (
github.com/choria-io/go-choria v0.12.2-0.20191025130451-091256f29013
github.com/choria-io/go-client v0.5.1
github.com/choria-io/go-config v0.0.4
github.com/choria-io/go-choria v0.13.0
github.com/choria-io/go-client v0.5.2
github.com/choria-io/go-config v0.0.5
github.com/choria-io/go-protocol v1.3.2
github.com/choria-io/mcorpc-agent-provider v0.8.0
github.com/choria-io/mcorpc-agent-provider v0.9.0
github.com/fatih/color v1.7.0
github.com/hokaccha/go-prettyjson v0.0.0-20180920040306-f579f869bbfe
github.com/hokaccha/go-prettyjson v0.0.0-20190818114111-108c894c2c0e
github.com/sirupsen/logrus v1.4.2
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/yaml.v2 v2.2.2
gopkg.in/yaml.v2 v2.2.4
)
Loading

0 comments on commit f6553c8

Please sign in to comment.