func (command *commandList) Execute(resource *handler.Resource) { opts := resource.Params.(*paramsList).opts pager := osSnapshots.List(command.Ctx.ServiceClient, opts) var snapshots []map[string]interface{} err := pager.EachPage(func(page pagination.Page) (bool, error) { info, err := osSnapshots.ExtractSnapshots(page) if err != nil { return false, err } result := make([]map[string]interface{}, len(info)) for j, snapshot := range info { result[j] = snapshotSingle(&snapshot) } snapshots = append(snapshots, result...) return true, nil }) if err != nil { resource.Err = err return } if len(snapshots) == 0 { resource.Result = nil } else { resource.Result = snapshots } }
// List returns Snapshots. func List(client *gophercloud.ServiceClient) pagination.Pager { return os.List(client, os.ListOpts{}) }