parent
d6fd9a07c2
commit
ab166c4448
14 changed files with 3 additions and 413 deletions
|
@ -1,10 +1,8 @@
|
|||
""" List and lookup repository images, and download image diffs. """
|
||||
""" List and lookup repository images. """
|
||||
|
||||
import json
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
from app import storage as store
|
||||
from endpoints.api import (resource, nickname, require_repo_read, RepositoryParamResource,
|
||||
format_date, NotFound, path_param)
|
||||
from data import model
|
||||
|
@ -104,27 +102,3 @@ class RepositoryImage(RepositoryParamResource):
|
|||
|
||||
return historical_image_view(image, image_map)
|
||||
|
||||
|
||||
@resource('/v1/repository/<repopath:repository>/image/<image_id>/changes')
|
||||
@path_param('repository', 'The full path of the repository. e.g. namespace/name')
|
||||
@path_param('image_id', 'The Docker image ID')
|
||||
class RepositoryImageChanges(RepositoryParamResource):
|
||||
""" Resource for handling repository image change lists. """
|
||||
|
||||
@cache_control_flask_restful(max_age=60*60) # Cache for one hour
|
||||
@require_repo_read
|
||||
@nickname('getImageChanges')
|
||||
def get(self, namespace, repository, image_id):
|
||||
""" Get the list of changes for the specified image. """
|
||||
image = model.image.get_repo_image_extended(namespace, repository, image_id)
|
||||
|
||||
if not image:
|
||||
raise NotFound()
|
||||
|
||||
diffs_path = store.image_file_diffs_path(image.storage.uuid)
|
||||
|
||||
try:
|
||||
response_json = json.loads(store.get_content(image.storage.locations, diffs_path))
|
||||
return response_json
|
||||
except IOError:
|
||||
raise NotFound()
|
||||
|
|
Reference in a new issue