Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api work #403

Merged
merged 30 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4827319
Implement more api handlers
cvaroqui Sep 1, 2023
30590d7
api tidying
cvaroqui Sep 1, 2023
a67daf1
Rename Preserved to IsPreserved
cvaroqui Sep 1, 2023
a8e805f
Add the GET /instance api handler
cvaroqui Sep 2, 2023
9202652
Stop using POST /object/monitor
cvaroqui Sep 4, 2023
e8b7d43
Use POST /object/action/abort instead of /object/abort
cvaroqui Sep 4, 2023
36d3ee9
Remove the POST /object/monitor handler
cvaroqui Sep 4, 2023
167dbbf
Add /node handlers
cvaroqui Sep 4, 2023
919f18b
Add /cluster handlers
cvaroqui Sep 5, 2023
6c21dbc
Use POST /cluster/action/* and POST /node/action/drain from cmd
cvaroqui Sep 5, 2023
977ce60
Rename "node abort" cmd as "cluster abort"
cvaroqui Sep 5, 2023
f586128
Fix the "om3 node drain" command
cvaroqui Sep 5, 2023
6a26c21
Add the "om <sel> instance ls" command
cvaroqui Sep 5, 2023
c145732
Make "instance ls" command available on mono-object selectors
cvaroqui Sep 5, 2023
9c77ad5
Use []instance.ResourceMonitor as instance.Monitor.Resources type
cvaroqui Sep 6, 2023
1347870
Add fine-grained "instance * ls" commands
cvaroqui Sep 6, 2023
5d8f610
Revert to maps to repr res config monitor and status in instance
cvaroqui Sep 7, 2023
6f5c76f
Rename resource.Status() to EvalStatus()
cvaroqui Sep 7, 2023
a22c35a
Renames in the resource package
cvaroqui Sep 7, 2023
c6791bf
Add the GET /object handler
cvaroqui Sep 8, 2023
04e5cc6
Add GET /resource handlers
cvaroqui Sep 8, 2023
4c4917d
Fix the daemondata test
cvaroqui Sep 10, 2023
1e2c735
Fix the cmd/svcapp... go test
cvaroqui Sep 10, 2023
823ae9e
Fix core/instance tests
cvaroqui Sep 11, 2023
df29284
Fix the core/object go tests
cvaroqui Sep 11, 2023
e21b55a
Add the "resource * ls" commandset
cvaroqui Sep 11, 2023
d1d7b51
Fix resource commands default columns in outputs
cvaroqui Sep 11, 2023
515f6ab
Don't exit from tab renderer on jsonpath find error
cvaroqui Sep 11, 2023
53d1162
Add more columns to the default "resource ls" renderer
cvaroqui Sep 11, 2023
9fae4e3
Fix a core/output error format
cvaroqui Sep 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@

* **breaking change:** "om node freeze" is now local only. Use "om cluster freeze" for the orchestrated freeze of all nodes. Same applies to "unfreeze" and its hidden alias "thaw".

* **breaking change:** "om cluster abort" replaces "om node abort" to abort the pending cluster action orchestration.

* **breaking change:** "om ... set|unset" no longer accept --param and --value. Use --kw instead, which was also supported in v2.

* "om monitor" instance availability icons changes:
Expand Down
40 changes: 40 additions & 0 deletions cmd/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ func init() {
cmdObjectComplianceShow := newCmdObjectComplianceShow(kind)
cmdObjectComplianceList := newCmdObjectComplianceList(kind)
cmdObjectEdit := newCmdObjectEdit(kind)
cmdObjectInstance := newCmdObjectInstance(kind)
cmdObjectInstanceConfig := newCmdObjectInstanceConfig(kind)
cmdObjectInstanceMonitor := newCmdObjectInstanceMonitor(kind)
cmdObjectInstanceStatus := newCmdObjectInstanceStatus(kind)
cmdObjectSet := newCmdObjectSet(kind)
cmdObjectPrint := newCmdObjectPrint(kind)
cmdObjectPrintConfig := newCmdObjectPrintConfig(kind)
cmdObjectResource := newCmdObjectResource(kind)
cmdObjectResourceConfig := newCmdObjectResourceConfig(kind)
cmdObjectResourceMonitor := newCmdObjectResourceMonitor(kind)
cmdObjectResourceStatus := newCmdObjectResourceStatus(kind)
cmdObjectPush := newCmdObjectPush(kind)
cmdObjectSync := newCmdObjectSync(kind)
cmdObjectValidate := newCmdObjectValidate(kind)
Expand All @@ -25,8 +33,10 @@ func init() {
cmdObjectCollector,
cmdObjectCompliance,
cmdObjectEdit,
cmdObjectInstance,
cmdObjectPrint,
cmdObjectPush,
cmdObjectResource,
cmdObjectSet,
cmdObjectSync,
cmdObjectValidate,
Expand Down Expand Up @@ -60,6 +70,36 @@ func init() {
newCmdObjectUnprovision(kind),
newCmdObjectUnset(kind),
)
cmdObjectInstanceConfig.AddCommand(
newCmdObjectInstanceConfigLs(kind),
)
cmdObjectInstanceMonitor.AddCommand(
newCmdObjectInstanceMonitorLs(kind),
)
cmdObjectInstanceStatus.AddCommand(
newCmdObjectInstanceStatusLs(kind),
)
cmdObjectInstance.AddCommand(
cmdObjectInstanceConfig,
cmdObjectInstanceMonitor,
cmdObjectInstanceStatus,
newCmdObjectInstanceLs(kind),
)
cmdObjectResourceConfig.AddCommand(
newCmdObjectResourceConfigLs(kind),
)
cmdObjectResourceMonitor.AddCommand(
newCmdObjectResourceMonitorLs(kind),
)
cmdObjectResourceStatus.AddCommand(
newCmdObjectResourceStatusLs(kind),
)
cmdObjectResource.AddCommand(
cmdObjectResourceConfig,
cmdObjectResourceMonitor,
cmdObjectResourceStatus,
newCmdObjectResourceLs(kind),
)
cmdObjectEdit.AddCommand(
newCmdObjectEditConfig(kind),
)
Expand Down
1 change: 1 addition & 0 deletions cmd/ccfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func init() {
cmdObjectSet,
cmdObjectPrint,
cmdObjectValidate,
newCmdClusterAbort(),
newCmdClusterFreeze(),
newCmdClusterThaw(),
newCmdClusterUnfreeze(),
Expand Down
5 changes: 5 additions & 0 deletions cmd/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ func init() {

cmdObject := newCmdCfg()
cmdObjectEdit := newCmdObjectEdit(kind)
cmdObjectInstance := newCmdObjectInstance(kind)
cmdObjectSet := newCmdObjectSet(kind)
cmdObjectPrint := newCmdObjectPrint(kind)
cmdObjectPrintConfig := newCmdObjectPrintConfig(kind)
Expand All @@ -15,6 +16,7 @@ func init() {
)
cmdObject.AddCommand(
cmdObjectEdit,
cmdObjectInstance,
cmdObjectPrint,
cmdObjectSet,
cmdObjectValidate,
Expand All @@ -39,6 +41,9 @@ func init() {
cmdObjectEdit.AddCommand(
newCmdObjectEditConfig(kind),
)
cmdObjectInstance.AddCommand(
newCmdObjectInstanceLs(kind),
)
cmdObjectPrint.AddCommand(
cmdObjectPrintConfig,
newCmdObjectPrintStatus(kind),
Expand Down
208 changes: 193 additions & 15 deletions cmd/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ func newCmdArrayLs() *cobra.Command {
return cmd
}

func newCmdClusterAbort() *cobra.Command {
var options commands.CmdClusterAbort
cmd := &cobra.Command{
Use: "abort",
Short: "abort the running orchestration",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run()
},
}
flags := cmd.Flags()
addFlagsAsync(flags, &options.OptsAsync)
addFlagsGlobal(flags, &options.OptsGlobal)
return cmd
}

func newCmdClusterFreeze() *cobra.Command {
var options commands.CmdClusterFreeze
cmd := &cobra.Command{
Expand Down Expand Up @@ -525,21 +540,6 @@ func newCmdNetworkStatus() *cobra.Command {
return cmd
}

func newCmdNodeAbort() *cobra.Command {
var options commands.CmdNodeAbort
cmd := &cobra.Command{
Use: "abort",
Short: "abort the running orchestration",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run()
},
}
flags := cmd.Flags()
addFlagsAsync(flags, &options.OptsAsync)
addFlagsGlobal(flags, &options.OptsGlobal)
return cmd
}

func newCmdNodeCapabilitiesList() *cobra.Command {
var options commands.CmdNodeCapabilitiesList
cmd := &cobra.Command{
Expand Down Expand Up @@ -1632,6 +1632,35 @@ func newCmdObjectComplianceList(kind string) *cobra.Command {
}
}

func newCmdObjectInstance(kind string) *cobra.Command {
return &cobra.Command{
Use: "instance",
Short: "config, status, monitor, ls",
Aliases: []string{"inst", "in"},
}
}

func newCmdObjectInstanceConfig(kind string) *cobra.Command {
return &cobra.Command{
Use: "config",
Aliases: []string{"conf", "cf"},
}
}

func newCmdObjectInstanceMonitor(kind string) *cobra.Command {
return &cobra.Command{
Use: "monitor",
Aliases: []string{"mon"},
}
}

func newCmdObjectInstanceStatus(kind string) *cobra.Command {
return &cobra.Command{
Use: "status",
Aliases: []string{"stat", "st"},
}
}

func newCmdObjectComplianceShow(kind string) *cobra.Command {
return &cobra.Command{
Use: "show",
Expand Down Expand Up @@ -2179,6 +2208,66 @@ func newCmdObjectPrintSchedule(kind string) *cobra.Command {
return cmd
}

func newCmdObjectInstanceLs(kind string) *cobra.Command {
var options commands.CmdObjectInstanceLs
cmd := &cobra.Command{
Use: "ls",
Aliases: []string{"list"},
Short: "object instances list",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run(selectorFlag, kind)
},
}
flags := cmd.Flags()
addFlagsGlobal(flags, &options.OptsGlobal)
return cmd
}

func newCmdObjectInstanceConfigLs(kind string) *cobra.Command {
var options commands.CmdObjectInstanceConfigLs
cmd := &cobra.Command{
Use: "ls",
Aliases: []string{"list"},
Short: "object instance configs list",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run(selectorFlag, kind)
},
}
flags := cmd.Flags()
addFlagsGlobal(flags, &options.OptsGlobal)
return cmd
}

func newCmdObjectInstanceStatusLs(kind string) *cobra.Command {
var options commands.CmdObjectInstanceStatusLs
cmd := &cobra.Command{
Use: "ls",
Aliases: []string{"list"},
Short: "object instance statuses list",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run(selectorFlag, kind)
},
}
flags := cmd.Flags()
addFlagsGlobal(flags, &options.OptsGlobal)
return cmd
}

func newCmdObjectInstanceMonitorLs(kind string) *cobra.Command {
var options commands.CmdObjectInstanceMonitorLs
cmd := &cobra.Command{
Use: "ls",
Aliases: []string{"list"},
Short: "object instances monitors list",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run(selectorFlag, kind)
},
}
flags := cmd.Flags()
addFlagsGlobal(flags, &options.OptsGlobal)
return cmd
}

func newCmdObjectPrintStatus(kind string) *cobra.Command {
var options commands.CmdObjectPrintStatus
cmd := &cobra.Command{
Expand Down Expand Up @@ -2381,6 +2470,95 @@ func newCmdObjectSyncUpdate(kind string) *cobra.Command {
return cmd
}

func newCmdObjectResource(kind string) *cobra.Command {
return &cobra.Command{
Use: "resource",
Short: "config, status, monitor, ls",
Aliases: []string{"res"},
}
}

func newCmdObjectResourceConfig(kind string) *cobra.Command {
return &cobra.Command{
Use: "config",
Aliases: []string{"conf", "cf"},
}
}

func newCmdObjectResourceMonitor(kind string) *cobra.Command {
return &cobra.Command{
Use: "monitor",
Aliases: []string{"mon"},
}
}

func newCmdObjectResourceStatus(kind string) *cobra.Command {
return &cobra.Command{
Use: "status",
Aliases: []string{"stat", "st"},
}
}

func newCmdObjectResourceLs(kind string) *cobra.Command {
var options commands.CmdObjectResourceLs
cmd := &cobra.Command{
Use: "ls",
Short: "list the selected resource (config, monitor, status)",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run(selectorFlag, kind)
},
}
flags := cmd.Flags()
addFlagsGlobal(flags, &options.OptsGlobal)
addFlagRID(flags, &options.RID)
return cmd
}

func newCmdObjectResourceConfigLs(kind string) *cobra.Command {
var options commands.CmdObjectResourceConfigLs
cmd := &cobra.Command{
Use: "ls",
Short: "list the selected resource config",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run(selectorFlag, kind)
},
}
flags := cmd.Flags()
addFlagsGlobal(flags, &options.OptsGlobal)
addFlagRID(flags, &options.RID)
return cmd
}

func newCmdObjectResourceMonitorLs(kind string) *cobra.Command {
var options commands.CmdObjectResourceMonitorLs
cmd := &cobra.Command{
Use: "ls",
Short: "list the selected resource monitor",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run(selectorFlag, kind)
},
}
flags := cmd.Flags()
addFlagsGlobal(flags, &options.OptsGlobal)
addFlagRID(flags, &options.RID)
return cmd
}

func newCmdObjectResourceStatusLs(kind string) *cobra.Command {
var options commands.CmdObjectResourceStatusLs
cmd := &cobra.Command{
Use: "ls",
Short: "list the selected resource status",
RunE: func(cmd *cobra.Command, args []string) error {
return options.Run(selectorFlag, kind)
},
}
flags := cmd.Flags()
addFlagsGlobal(flags, &options.OptsGlobal)
addFlagRID(flags, &options.RID)
return cmd
}

func newCmdObjectRun(kind string) *cobra.Command {
var options commands.CmdObjectRun
cmd := &cobra.Command{
Expand Down
1 change: 0 additions & 1 deletion cmd/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ func init() {
cmdNodePush,
cmdNodeRelay,
cmdNodeValidate,
newCmdNodeAbort(),
newCmdNodeChecks(),
newCmdNodeClear(),
newCmdNodeDoc(),
Expand Down
5 changes: 5 additions & 0 deletions cmd/sec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ func init() {

cmdObject := newCmdSec()
cmdObjectEdit := newCmdObjectEdit(kind)
cmdObjectInstance := newCmdObjectInstance(kind)
cmdObjectSet := newCmdObjectSet(kind)
cmdObjectPrint := newCmdObjectPrint(kind)
cmdObjectPrintConfig := newCmdObjectPrintConfig(kind)
Expand All @@ -15,6 +16,7 @@ func init() {
)
cmdObject.AddCommand(
cmdObjectEdit,
cmdObjectInstance,
cmdObjectPrint,
cmdObjectSet,
cmdObjectValidate,
Expand All @@ -41,6 +43,9 @@ func init() {
cmdObjectEdit.AddCommand(
newCmdObjectEditConfig(kind),
)
cmdObjectInstance.AddCommand(
newCmdObjectInstanceLs(kind),
)
cmdObjectPrint.AddCommand(
cmdObjectPrintConfig,
newCmdObjectPrintStatus(kind),
Expand Down
Loading