Skip to content

Commit

Permalink
server/list: Add missing PlacementGroup to JSON (#416)
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Siewert <[email protected]>
  • Loading branch information
sinuscosinustan authored Nov 14, 2022
1 parent 7d6990f commit 57cfec5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/cmd/server/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ var ListCmd = base.ListCmd{
Labels: server.Labels,
PrimaryDiskSize: server.PrimaryDiskSize,
}
if server.PlacementGroup != nil {
serverPlacementGroup := util.PlacementGroupToSchema(*server.PlacementGroup)
serverSchema.PlacementGroup = &serverPlacementGroup
}
if server.Image != nil {
serverImage := util.ImageToSchema(*server.Image)
serverSchema.Image = &serverImage
Expand Down
11 changes: 11 additions & 0 deletions internal/cmd/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,17 @@ func LoadBalancerTypeToSchema(loadBalancerType hcloud.LoadBalancerType) schema.L
return loadBalancerTypeSchema
}

func PlacementGroupToSchema(placementGroup hcloud.PlacementGroup) schema.PlacementGroup {
return schema.PlacementGroup{
ID: placementGroup.ID,
Name: placementGroup.Name,
Labels: placementGroup.Labels,
Created: placementGroup.Created,
Type: string(placementGroup.Type),
Servers: placementGroup.Servers,
}
}

// ValidateRequiredFlags ensures that flags has values for all flags with
// the passed names.
//
Expand Down

0 comments on commit 57cfec5

Please sign in to comment.