Skip to content

Commit

Permalink
k8s list-associated-resources: Output strings. (#961)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsomething authored Feb 22, 2021
1 parent 9674b8b commit 0099202
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions commands/displayers/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,20 @@ func (ar *KubernetesAssociatedResources) ColMap() map[string]string {

func (ar *KubernetesAssociatedResources) KV() []map[string]interface{} {
out := make([]map[string]interface{}, 0, 1)

o := map[string]interface{}{
"Volumes": ar.KubernetesAssociatedResources.Volumes,
"VolumeSnapshots": ar.KubernetesAssociatedResources.VolumeSnapshots,
"LoadBalancers": ar.KubernetesAssociatedResources.LoadBalancers,
"Volumes": flattenAssociatedResourceIDs(ar.KubernetesAssociatedResources.Volumes),
"VolumeSnapshots": flattenAssociatedResourceIDs(ar.KubernetesAssociatedResources.VolumeSnapshots),
"LoadBalancers": flattenAssociatedResourceIDs(ar.KubernetesAssociatedResources.LoadBalancers),
}
out = append(out, o)
return out
}

func flattenAssociatedResourceIDs(resources []*godo.AssociatedResource) (out []string) {
for _, r := range resources {
out = append(out, r.ID)
}

return out
}

0 comments on commit 0099202

Please sign in to comment.