This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/endpoints/v2/tag.py

29 lines
965 B
Python
Raw Normal View History

2016-07-26 22:41:51 +00:00
from flask import jsonify
from auth.registry_jwt_auth import process_registry_jwt_auth
2016-03-09 21:20:28 +00:00
from endpoints.common import parse_repository_name
2016-08-02 00:48:00 +00:00
from endpoints.v2 import v2_bp, require_repo_read, paginate
from endpoints.v2.errors import NameUnknown
from endpoints.decorators import anon_protect
from data.interfaces.v2 import PreOCIModel as model
@v2_bp.route('/<repopath:repository>/tags/list', methods=['GET'])
2016-03-09 21:20:28 +00:00
@parse_repository_name()
@process_registry_jwt_auth(scopes=['pull'])
@require_repo_read
@anon_protect
2016-08-02 00:48:00 +00:00
@paginate()
2016-07-26 22:41:51 +00:00
def list_all_tags(namespace_name, repo_name, limit, offset, pagination_callback):
repo = model.get_repository(namespace_name, repo_name)
2016-07-26 22:41:51 +00:00
if repo is None:
raise NameUnknown()
tags = model.repository_tags(namespace_name, repo_name, limit, offset)
response = jsonify({
2016-03-09 21:20:28 +00:00
'name': '{0}/{1}'.format(namespace_name, repo_name),
2016-07-26 22:41:51 +00:00
'tags': [tag.name for tag in tags],
})
2016-07-26 22:41:51 +00:00
pagination_callback(len(tags), response)
return response