(deps commandDeps)
| 338 | } |
| 339 | |
| 340 | func newAgentHeartbeatInspectCommand(deps commandDeps) *cobra.Command { |
| 341 | cmd := &cobra.Command{ |
| 342 | Use: "inspect <agent>", |
| 343 | Short: "Inspect one agent's resolved Heartbeat policy", |
| 344 | Example: " agh agent heartbeat inspect coder --workspace checkout-api --json", |
| 345 | Args: exactOneNonBlankArg(), |
| 346 | RunE: func(cmd *cobra.Command, args []string) error { |
| 347 | client, err := clientFromDeps(deps) |
| 348 | if err != nil { |
| 349 | return err |
| 350 | } |
| 351 | query, err := agentQueryFromCommand(cmd) |
| 352 | if err != nil { |
| 353 | return err |
| 354 | } |
| 355 | record, err := client.GetAgentHeartbeat(cmd.Context(), args[0], query) |
| 356 | if err != nil { |
| 357 | return err |
| 358 | } |
| 359 | return writeCommandOutput(cmd, agentHeartbeatBundle(&record)) |
| 360 | }, |
| 361 | } |
| 362 | addWorkspaceFlag(cmd) |
| 363 | return cmd |
| 364 | } |
| 365 | |
| 366 | func newAgentHeartbeatValidateCommand(deps commandDeps) *cobra.Command { |
| 367 | var input authoredBodyInput |
no test coverage detected