add server req accounts
@@ -29,6 +29,7 @@ type SrvRequestCmd struct {
name string
host string
cluster string
+ account string
limit int
offset int
@@ -83,6 +84,10 @@ func configureServerRequestCommand(srv *kingpin.CmdClause) {
leafz := req.Command("leafnodes", "Show leafnode details").Alias("leaf").Alias("leafz").Action(c.leafz)
leafz.Arg("wait", "Wait for a certain number of responses").Default("1").IntVar(&c.waitFor)
leafz.Flag("subscriptions", "Show subscription detail").Default("false").BoolVar(&c.detail)
+
+ accountz := req.Command("accounts", "Show account defailts").Alias("accountz").Alias("acct").Action(c.accountz)
+ accountz.Arg("wait", "Wait for a certain number of responses").Default("1").IntVar(&c.waitFor)
+ accountz.Flag("account", "Retrieve information for a specific account").StringVar(&c.account)
}
func (c *SrvRequestCmd) reqFilter() server.EventFilterOptions {
@@ -93,6 +98,30 @@ func (c *SrvRequestCmd) reqFilter() server.EventFilterOptions {
}
}
+func (c *SrvRequestCmd) accountz(_ *kingpin.ParseContext) error {
+ nc, _, err := prepareHelper("", natsOpts()...)
+ if err != nil {
+ return err
+ }
+
+ opts := server.AccountzEventOptions{
+ AccountzOptions: server.AccountzOptions{Account: c.account},
+ EventFilterOptions: c.reqFilter(),
+ }
+
+ res, err := c.doReq("ACCOUNTZ", &opts, nc)
+ if err != nil {
+ return err
+ }
+
+ for _, m := range res {
+ fmt.Println(string(m))
+ }
+
+ return nil
+
+}
+
func (c *SrvRequestCmd) leafz(_ *kingpin.ParseContext) error {
nc, _, err := prepareHelper("", natsOpts()...)
if err != nil {
@@ -114,7 +143,6 @@ func (c *SrvRequestCmd) leafz(_ *kingpin.ParseContext) error {
}
return nil
-
}
func (c *SrvRequestCmd) gwyz(_ *kingpin.ParseContext) error {
