Skip to content

Commit

Permalink
feat: Update fields included in JSON output for workers list (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
hnrkndrssn authored Oct 31, 2023
1 parent 4df2318 commit 9bb3d43
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pkg/cmd/worker/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ func ListRun(opts *ListOptions) error {
}

type TargetAsJson struct {
Id string `json:"Id"`
Name string `json:"Name"`
Type string `json:"Type"`
WorkerPools []model.Entity `json:"WorkerPools"`
Id string `json:"Id"`
Name string `json:"Name"`
Type string `json:"Type"`
HealthStatus string `json:"HealthStatus"`
StatusSummary string `json:"StatusSummary"`
WorkerPools []model.Entity `json:"WorkerPools"`
}

workerPoolMap, err := GetWorkerPoolMap(opts)
Expand All @@ -64,10 +66,12 @@ func ListRun(opts *ListOptions) error {
Json: func(item *machines.Worker) any {

return TargetAsJson{
Id: item.GetID(),
Name: item.Name,
Type: machinescommon.CommunicationStyleToDeploymentTargetTypeMap[item.Endpoint.GetCommunicationStyle()],
WorkerPools: resolveEntities(item.WorkerPoolIDs, workerPoolMap),
Id: item.GetID(),
Name: item.Name,
Type: machinescommon.CommunicationStyleToDeploymentTargetTypeMap[item.Endpoint.GetCommunicationStyle()],
HealthStatus: item.HealthStatus,
StatusSummary: item.StatusSummary,
WorkerPools: resolveEntities(item.WorkerPoolIDs, workerPoolMap),
}
},
Table: output.TableDefinition[*machines.Worker]{
Expand Down

0 comments on commit 9bb3d43

Please sign in to comment.