def _route_images_id(image_id): """ Route: /v1/images/<image_id> Method: GET, HEAD, DELETE, PUT """ utils.show_request(bottle.request) # glance image-list if image_id == 'detail' and bottle.request.method == 'GET': return {'images': IMAGES.list()} # glance image-show <image_id> if image_id != 'detail' and bottle.request.method == 'HEAD': image = IMAGES.show(image_id) _add_header(image) return # glance image-delete <image_id> if image_id != 'detail' and bottle.request.method == 'DELETE': IMAGES.delete(image_id) return # glance image-update <image_id> if image_id != 'detail' and bottle.request.method == 'PUT': image_md = _from_headers(bottle.request.headers) return {'image': IMAGES.update(image_id, image_md)} bottle.abort(400, 'Unable to handle request')