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

Function getWorkerAsBasic

pkg/cmd/worker/view/view.go:118–141  ·  view source on GitHub ↗
(opts *shared.ViewOptions, worker *machines.Worker)

Source from the content-addressed store, hash-verified

116}
117
118func getWorkerAsBasic(opts *shared.ViewOptions, worker *machines.Worker) string {
119 var result strings.Builder
120
121 result.WriteString(fmt.Sprintf("%s %s\n", output.Bold(worker.Name), output.Dimf("(%s)", worker.GetID())))
122 result.WriteString(fmt.Sprintf("Health status: %s\n", getHealthStatusFormatted(worker.HealthStatus)))
123 result.WriteString(fmt.Sprintf("Current status: %s\n", worker.StatusSummary))
124 result.WriteString(fmt.Sprintf("Communication style: %s\n", getWorkerTypeDisplayName(worker.Endpoint.GetCommunicationStyle())))
125
126 workerPoolMap, _ := shared.GetWorkerPoolMap(opts)
127 workerPoolNames := resolveValues(worker.WorkerPoolIDs, workerPoolMap)
128 result.WriteString(fmt.Sprintf("Worker Pools: %s\n", output.FormatAsList(workerPoolNames)))
129
130 // Add endpoint-specific details
131 endpointDetails := getEndpointDetails(worker)
132 for key, value := range endpointDetails {
133 result.WriteString(fmt.Sprintf("%s: %s\n", key, value))
134 }
135
136 // Web URL
137 url := util.GenerateWebURL(opts.Host, worker.SpaceID, fmt.Sprintf("infrastructure/workers/%s/settings", worker.GetID()))
138 result.WriteString(fmt.Sprintf("\nView this worker in Octopus Deploy: %s\n", output.Blue(url)))
139
140 return result.String()
141}
142
143func getHealthStatusFormatted(status string) string {
144 switch status {

Callers 1

ViewRunFunction · 0.85

Calls 10

BoldFunction · 0.92
DimfFunction · 0.92
GetWorkerPoolMapFunction · 0.92
FormatAsListFunction · 0.92
GenerateWebURLFunction · 0.92
BlueFunction · 0.92
getHealthStatusFormattedFunction · 0.85
getWorkerTypeDisplayNameFunction · 0.85
getEndpointDetailsFunction · 0.85
resolveValuesFunction · 0.70

Tested by

no test coverage detected