MCPcopy
hub / github.com/crowdsecurity/crowdsec / dumpLAPIStatus

Method dumpLAPIStatus

cmd/crowdsec-cli/clisupport/support.go:284–304  ·  view source on GitHub ↗
(ctx context.Context, zw *zip.Writer, hub *cwhub.Hub)

Source from the content-addressed store, hash-verified

282}
283
284func (cli *cliSupport) dumpLAPIStatus(ctx context.Context, zw *zip.Writer, hub *cwhub.Hub) error {
285 if hub == nil {
286 return errors.New("hub is nil")
287 }
288
289 fmt.Fprintln(os.Stdout, "Collecting LAPI status")
290
291 out := new(bytes.Buffer)
292 cl := clilapi.New(cli.cfg)
293
294 err := cl.Status(ctx, out, hub)
295 if err != nil {
296 fmt.Fprintf(out, "%s\n", err)
297 }
298
299 stripped := stripAnsiString(out.String())
300
301 cli.writeToZip(zw, SUPPORT_LAPI_STATUS_PATH, time.Now(), strings.NewReader(stripped))
302
303 return nil
304}
305
306func (cli *cliSupport) dumpCAPIStatus(ctx context.Context, zw *zip.Writer, hub *cwhub.Hub, db *database.Client) error {
307 if hub == nil {

Callers 1

dumpMethod · 0.95

Calls 6

writeToZipMethod · 0.95
NewFunction · 0.92
stripAnsiStringFunction · 0.85
NewReaderMethod · 0.80
StatusMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected