(opts *ViewOptions, contributeEndpoint ContributeEndpointCallback, description string)
| 38 | } |
| 39 | |
| 40 | func ViewRun(opts *ViewOptions, contributeEndpoint ContributeEndpointCallback, description string) error { |
| 41 | var worker, err = opts.Client.Workers.GetByIdentifier(opts.IdOrName) |
| 42 | if err != nil { |
| 43 | return err |
| 44 | } |
| 45 | |
| 46 | data := []*output.DataRow{} |
| 47 | |
| 48 | data = append(data, output.NewDataRow("Name", fmt.Sprintf("%s %s", output.Bold(worker.Name), output.Dimf("(%s)", worker.GetID())))) |
| 49 | data = append(data, output.NewDataRow("Health status", getHealthStatus(worker))) |
| 50 | data = append(data, output.NewDataRow("Current status", worker.StatusSummary)) |
| 51 | |
| 52 | workerPoolMap, err := GetWorkerPoolMap(opts) |
| 53 | workerPoolNames := resolveValues(worker.WorkerPoolIDs, workerPoolMap) |
| 54 | data = append(data, output.NewDataRow("Worker Pools", output.FormatAsList(workerPoolNames))) |
| 55 | |
| 56 | if contributeEndpoint != nil { |
| 57 | newRows, err := contributeEndpoint(opts, worker.Endpoint) |
| 58 | if err != nil { |
| 59 | return err |
| 60 | } |
| 61 | for _, r := range newRows { |
| 62 | data = append(data, r) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | output.PrintRows(data, opts.Out) |
| 67 | |
| 68 | fmt.Fprintf(opts.Out, "\n") |
| 69 | machinescommon.DoWebForWorkers(worker, opts.Dependencies, opts.WebFlags, description) |
| 70 | return nil |
| 71 | |
| 72 | return nil |
| 73 | } |
| 74 | |
| 75 | func ContributeProxy(opts *ViewOptions, proxyID string) ([]*output.DataRow, error) { |
| 76 | if proxyID != "" { |
no test coverage detected