(opts *shared.ViewOptions)
| 40 | } |
| 41 | |
| 42 | func ViewRun(opts *shared.ViewOptions) error { |
| 43 | var workerPool, err = opts.Client.WorkerPools.GetByIdentifier(opts.IdOrName) |
| 44 | if err != nil { |
| 45 | return err |
| 46 | } |
| 47 | |
| 48 | err = output.PrintResource(workerPool, opts.Command, output.Mappers[workerpools.IWorkerPool]{ |
| 49 | Json: func(wp workerpools.IWorkerPool) any { |
| 50 | return getWorkerPoolAsJson(opts, wp) |
| 51 | }, |
| 52 | Table: output.TableDefinition[workerpools.IWorkerPool]{ |
| 53 | Header: []string{"NAME", "TYPE", "DEFAULT", "WORKERS", "HEALTHY", "UNHEALTHY"}, |
| 54 | Row: func(wp workerpools.IWorkerPool) []string { |
| 55 | return getWorkerPoolAsTableRow(opts, wp) |
| 56 | }, |
| 57 | }, |
| 58 | Basic: func(wp workerpools.IWorkerPool) string { |
| 59 | return getWorkerPoolAsBasic(opts, wp) |
| 60 | }, |
| 61 | }) |
| 62 | if err != nil { |
| 63 | return err |
| 64 | } |
| 65 | |
| 66 | if opts.WebFlags != nil && opts.WebFlags.Web.Value { |
| 67 | machinescommon.DoWebForWorkerPools(workerPool, opts.Dependencies, opts.WebFlags) |
| 68 | } |
| 69 | |
| 70 | return nil |
| 71 | } |
| 72 | |
| 73 | type WorkerPoolAsJson struct { |
| 74 | Id string `json:"Id"` |
no test coverage detected