diff --git a/internal/cmd/server/list.go b/internal/cmd/server/list.go index c1f36bb7..3d91e4cd 100644 --- a/internal/cmd/server/list.go +++ b/internal/cmd/server/list.go @@ -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 diff --git a/internal/cmd/util/util.go b/internal/cmd/util/util.go index ee0b6ce6..c9e45874 100644 --- a/internal/cmd/util/util.go +++ b/internal/cmd/util/util.go @@ -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. //