MCPcopy Create free account
hub / github.com/hashicorp/vault / totalOutput

Method totalOutput

command/operator_usage.go:310–346  ·  view source on GitHub ↗
(data map[string]interface{})

Source from the content-addressed store, hash-verified

308}
309
310func (c *OperatorUsageCommand) totalOutput(data map[string]interface{}) []string {
311 // blank line separating it from namespaces
312 out := []string{" | | | | | "}
313
314 total, ok := data["total"].(map[string]interface{})
315 if !ok {
316 c.UI.Error("missing total in response")
317 return out
318 }
319
320 entityCount, ok := jsonNumberOK(total, "entity_clients")
321 if !ok {
322 c.UI.Error("missing entity_clients in total")
323 return out
324 }
325
326 tokenCount, ok := jsonNumberOK(total, "non_entity_clients")
327 if !ok {
328 c.UI.Error("missing non_entity_clients in total")
329 return out
330 }
331 // don't error if secret syncs key is missing
332 secretSyncs, _ := jsonNumberOK(total, "secret_syncs")
333
334 // don't error if acme clients is missing
335 acmeCount, _ := jsonNumberOK(total, "acme_clients")
336
337 clientCount, ok := jsonNumberOK(total, "clients")
338 if !ok {
339 c.UI.Error("missing clients in total")
340 return out
341 }
342
343 out = append(out, fmt.Sprintf("Total | %d | %d | %d | %d | %d",
344 entityCount, tokenCount, secretSyncs, acmeCount, clientCount))
345 return out
346}

Callers 1

RunMethod · 0.95

Calls 2

jsonNumberOKFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected