// ListImages returns a list of images in a store func (handler *StorageHandlersImpl) ListImages(params storage.ListImagesParams) middleware.Responder { u, err := util.ImageStoreNameToURL(params.StoreName) if err != nil { return storage.NewListImagesDefault(http.StatusInternalServerError).WithPayload( &models.Error{ Code: swag.Int64(http.StatusInternalServerError), Message: err.Error(), }) } images, err := storageImageLayer.ListImages(context.TODO(), u, params.Ids) if err != nil { return storage.NewListImagesNotFound().WithPayload( &models.Error{ Code: swag.Int64(http.StatusNotFound), Message: err.Error(), }) } result := make([]*models.Image, 0, len(images)) for _, image := range images { result = append(result, convertImage(image)) } return storage.NewListImagesOK().WithPayload(result) }
// ListImages returns a list of images in a store func (h *StorageHandlersImpl) ListImages(params storage.ListImagesParams) middleware.Responder { u, err := util.ImageStoreNameToURL(params.StoreName) if err != nil { return storage.NewListImagesDefault(http.StatusInternalServerError).WithPayload( &models.Error{ Code: swag.Int64(http.StatusInternalServerError), Message: err.Error(), }) } op := trace.NewOperation(context.Background(), fmt.Sprintf("ListImages(%s, %q)", u.String(), params.Ids)) images, err := h.imageCache.ListImages(op, u, params.Ids) if err != nil { return storage.NewListImagesNotFound().WithPayload( &models.Error{ Code: swag.Int64(http.StatusNotFound), Message: err.Error(), }) } result := make([]*models.Image, 0, len(images)) for _, image := range images { result = append(result, convertImage(image)) } return storage.NewListImagesOK().WithPayload(result) }