mirror of
https://github.com/hanzozt/zt.git
synced 2026-11-03 05:01:58 +00:00
Refactor raft to cluster under agent Add inspect sub-commands Add more regions to test ami Add dns configuration to test-ami to enable router in tunnel mode
41 lines
962 B
Go
41 lines
962 B
Go
package fabric
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
type InspectCircuitsAction struct {
|
|
InspectAction
|
|
includeStacks bool
|
|
}
|
|
|
|
func (self *InspectCircuitsAction) addFlags(cmd *cobra.Command) *cobra.Command {
|
|
self.InspectAction.addFlags(cmd)
|
|
cmd.Flags().BoolVar(&self.includeStacks, "include-stacks", false, "Include stack information")
|
|
return cmd
|
|
}
|
|
|
|
func (self *InspectCircuitsAction) newCobraCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "circuit",
|
|
Short: "query routers to get diagnostic information for a circuit",
|
|
RunE: self.runInspectCircuit,
|
|
Args: cobra.RangeArgs(1, 2),
|
|
}
|
|
return self.addFlags(cmd)
|
|
}
|
|
|
|
func (self *InspectCircuitsAction) runInspectCircuit(_ *cobra.Command, args []string) error {
|
|
requestedValue := "circuit:"
|
|
if self.includeStacks {
|
|
requestedValue = "circuitAndStacks:"
|
|
}
|
|
requestedValue += args[0]
|
|
|
|
appRegex := ".*"
|
|
if len(args) > 1 {
|
|
appRegex = args[1]
|
|
}
|
|
return self.inspect(appRegex, requestedValue)
|
|
}
|