MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / ViewRun

Function ViewRun

pkg/cmd/worker/view/view.go:41–70  ·  view source on GitHub ↗
(opts *shared.ViewOptions)

Source from the content-addressed store, hash-verified

39}
40
41func ViewRun(opts *shared.ViewOptions) error {
42 var worker, err = opts.Client.Workers.GetByIdentifier(opts.IdOrName)
43 if err != nil {
44 return err
45 }
46
47 err = output.PrintResource(worker, opts.Command, output.Mappers[*machines.Worker]{
48 Json: func(w *machines.Worker) any {
49 return getWorkerAsJson(opts, w)
50 },
51 Table: output.TableDefinition[*machines.Worker]{
52 Header: []string{"NAME", "TYPE", "HEALTH", "STATUS", "WORKER POOLS", "ENDPOINT DETAILS"},
53 Row: func(w *machines.Worker) []string {
54 return getWorkerAsTableRow(opts, w)
55 },
56 },
57 Basic: func(w *machines.Worker) string {
58 return getWorkerAsBasic(opts, w)
59 },
60 })
61 if err != nil {
62 return err
63 }
64
65 if opts.WebFlags != nil && opts.WebFlags.Web.Value {
66 machinescommon.DoWebForWorkers(worker, opts.Dependencies, opts.WebFlags, getWorkerTypeDisplayName(worker.Endpoint.GetCommunicationStyle()))
67 }
68
69 return nil
70}
71
72type WorkerAsJson struct {
73 Id string `json:"Id"`

Callers 1

NewCmdViewFunction · 0.70

Calls 6

PrintResourceFunction · 0.92
DoWebForWorkersFunction · 0.92
getWorkerAsJsonFunction · 0.85
getWorkerAsTableRowFunction · 0.85
getWorkerAsBasicFunction · 0.85
getWorkerTypeDisplayNameFunction · 0.85

Tested by

no test coverage detected