(d map[string]interface{})
| 356 | } |
| 357 | |
| 358 | func (t *cmdDashboard) handleProxyCommand(d map[string]interface{}) { |
| 359 | c := t.newTopomClient() |
| 360 | |
| 361 | switch { |
| 362 | |
| 363 | case d["--create-proxy"].(bool): |
| 364 | |
| 365 | addr := utils.ArgumentMust(d, "--addr") |
| 366 | |
| 367 | log.Debugf("call rpc create-proxy to dashboard %s", t.addr) |
| 368 | if err := c.CreateProxy(addr); err != nil { |
| 369 | log.PanicErrorf(err, "call rpc create-proxy to dashboard %s failed", t.addr) |
| 370 | } |
| 371 | log.Debugf("call rpc create-proxy OK") |
| 372 | |
| 373 | case d["--online-proxy"].(bool): |
| 374 | |
| 375 | addr := utils.ArgumentMust(d, "--addr") |
| 376 | |
| 377 | log.Debugf("call rpc online-proxy to dashboard %s", t.addr) |
| 378 | if err := c.OnlineProxy(addr); err != nil { |
| 379 | log.PanicErrorf(err, "call rpc online-proxy to dashboard %s failed", t.addr) |
| 380 | } |
| 381 | log.Debugf("call rpc online-proxy OK") |
| 382 | |
| 383 | case d["--remove-proxy"].(bool): |
| 384 | |
| 385 | force := d["--force"].(bool) |
| 386 | |
| 387 | for _, token := range t.parseProxyTokens(d) { |
| 388 | log.Debugf("call rpc remove-proxy to dashboard %s", t.addr) |
| 389 | if err := c.RemoveProxy(token, force); err != nil { |
| 390 | log.PanicErrorf(err, "call rpc remove-proxy to dashboard %s failed", t.addr) |
| 391 | } |
| 392 | log.Debugf("call rpc remove-proxy OK") |
| 393 | } |
| 394 | |
| 395 | case d["--reinit-proxy"].(bool): |
| 396 | |
| 397 | switch { |
| 398 | |
| 399 | default: |
| 400 | |
| 401 | for _, token := range t.parseProxyTokens(d) { |
| 402 | log.Debugf("call rpc reinit-proxy to dashboard %s", t.addr) |
| 403 | if err := c.ReinitProxy(token); err != nil { |
| 404 | log.PanicErrorf(err, "call rpc reinit-proxy to dashboard %s failed", t.addr) |
| 405 | } |
| 406 | log.Debugf("call rpc reinit-proxy OK") |
| 407 | } |
| 408 | |
| 409 | case d["--all"].(bool): |
| 410 | |
| 411 | log.Debugf("call rpc stats to dashboard %s", t.addr) |
| 412 | s, err := c.Stats() |
| 413 | if err != nil { |
| 414 | log.PanicErrorf(err, "call rpc stats to dashboard %s failed", t.addr) |
| 415 | } |
no test coverage detected