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

Method Run

command/operator_key_status.go:51–84  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

49}
50
51func (c *OperatorKeyStatusCommand) Run(args []string) int {
52 f := c.Flags()
53
54 if err := f.Parse(args); err != nil {
55 c.UI.Error(err.Error())
56 return 1
57 }
58
59 args = f.Args()
60 if len(args) > 0 {
61 c.UI.Error(fmt.Sprintf("Too many arguments (expected 0, got %d)", len(args)))
62 return 1
63 }
64
65 client, err := c.Client()
66 if err != nil {
67 c.UI.Error(err.Error())
68 return 2
69 }
70
71 status, err := client.Sys().KeyStatus()
72 if err != nil {
73 c.UI.Error(fmt.Sprintf("Error reading key status: %s", err))
74 return 2
75 }
76
77 switch Format(c.UI) {
78 case "table":
79 c.UI.Output(printKeyStatus(status))
80 return 0
81 default:
82 return OutputData(c.UI, status)
83 }
84}

Callers

nothing calls this directly

Calls 11

FlagsMethod · 0.95
FormatFunction · 0.85
printKeyStatusFunction · 0.85
OutputDataFunction · 0.85
ArgsMethod · 0.80
KeyStatusMethod · 0.80
SysMethod · 0.80
ParseMethod · 0.65
ErrorMethod · 0.65
ClientMethod · 0.65
OutputMethod · 0.65

Tested by

no test coverage detected