Internally handling most_recent logic.

This commit is contained in:
Tom Carrio
2018-08-19 18:45:22 -04:00
parent 2d5d1890d4
commit 4147062802
2 changed files with 7 additions and 5 deletions
+3 -5
View File
@@ -8,8 +8,7 @@ import (
)
const (
mostRecentSortDir = "desc"
mostRecentSortKey = "created_at"
mostRecentSort = "created_at:desc"
)
var validFields = map[string]string{
@@ -99,9 +98,8 @@ func buildImageFilters(input map[string]interface{}, listOpts *images.ListOpts)
// See https://developer.openstack.org/api-ref/image/v2/
func applyMostRecent(listOpts *images.ListOpts) {
// Sort isn't supported through our API so there should be no existing values.
// Overwriting .Sort is okay.
listOpts.SortKey = mostRecentSortKey
listOpts.SortDir = mostRecentSortDir
// Overwriting ListOpts.Sort is okay.
listOpts.Sort = mostRecentSort
listOpts.Limit = 1
return