Skip to content

Commit

Permalink
Listing volumes in images -a (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Jun 5, 2015
1 parent 7f95f5d commit a97db19
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions images.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,26 @@ func runImages(cmd *Command, args []string) {
Public: false,
})
}

volumes, err := cmd.API.GetVolumes()
if err != nil {
log.Fatalf("unable to fetch volumes from the Scaleway API: %v", err)
}
for _, val := range *volumes {
creationDate, err := time.Parse("2006-01-02T15:04:05.000000+00:00", val.CreationDate)
if err != nil {
log.Fatalf("unable to parse creation date from the Scaleway API: %v", err)
}
entries = append(entries, ScalewayImageInterface{
Type: "volume",
CreationDate: creationDate,
Identifier: val.Identifier,
Name: val.Name,
Tag: "<none>",
VirtualSize: float64(val.Size),
Public: false,
})
}
}

w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0)
Expand Down

0 comments on commit a97db19

Please sign in to comment.