Changeset View
Changeset View
Standalone View
Standalone View
swh/web/api/views/vault.py
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | |||||
@api_route( | @api_route( | ||||
r"/vault/directory/(?P<dir_id>[0-9a-f]+)/", | r"/vault/directory/(?P<dir_id>[0-9a-f]+)/", | ||||
"api-1-vault-cook-directory", | "api-1-vault-cook-directory", | ||||
methods=["GET", "POST"], | methods=["GET", "POST"], | ||||
checksum_args=["dir_id"], | checksum_args=["dir_id"], | ||||
throttle_scope="swh_vault_cooking", | throttle_scope="swh_vault_cooking", | ||||
never_cache=True, | never_cache=True, | ||||
) | ) | ||||
@api_doc("/vault/directory/", tags=["hidden"]) | @api_doc("/vault/directory/", tags=["deprecated"]) | ||||
@format_docstring() | @format_docstring() | ||||
def api_vault_cook_directory(request, dir_id): | def api_vault_cook_directory(request, dir_id): | ||||
""" | """ | ||||
.. http:get:: /api/1/vault/directory/(dir_id)/ | .. http:get:: /api/1/vault/directory/(dir_id)/ | ||||
This endpoint was replaced by :http:get:`/api/1/vault/flat/(swhid)/` | This endpoint was replaced by :http:get:`/api/1/vault/flat/(swhid)/` | ||||
""" | """ | ||||
_, obj_id = query.parse_hash_with_algorithms_or_throws( | _, obj_id = query.parse_hash_with_algorithms_or_throws( | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def api_vault_fetch_flat(request, swhid): | ||||
return response | return response | ||||
@api_route( | @api_route( | ||||
r"/vault/directory/(?P<dir_id>[0-9a-f]+)/raw/", | r"/vault/directory/(?P<dir_id>[0-9a-f]+)/raw/", | ||||
"api-1-vault-fetch-directory", | "api-1-vault-fetch-directory", | ||||
checksum_args=["dir_id"], | checksum_args=["dir_id"], | ||||
) | ) | ||||
@api_doc("/vault/directory/raw/", tags=["hidden"]) | @api_doc("/vault/directory/raw/", tags=["hidden", "deprecated"]) | ||||
def api_vault_fetch_directory(request, dir_id): | def api_vault_fetch_directory(request, dir_id): | ||||
""" | """ | ||||
.. http:get:: /api/1/vault/directory/(dir_id)/raw/ | .. http:get:: /api/1/vault/directory/(dir_id)/raw/ | ||||
This endpoint was replaced by :http:get:`/api/1/vault/flat/raw/` | This endpoint was replaced by :http:get:`/api/1/vault/flat/raw/` | ||||
""" | """ | ||||
_, obj_id = query.parse_hash_with_algorithms_or_throws( | _, obj_id = query.parse_hash_with_algorithms_or_throws( | ||||
dir_id, ["sha1"], "Only sha1_git is supported." | dir_id, ["sha1"], "Only sha1_git is supported." | ||||
Show All 10 Lines | |||||
@api_route( | @api_route( | ||||
f"/vault/gitfast/(?P<swhid>{SWHID_RE})/", | f"/vault/gitfast/(?P<swhid>{SWHID_RE})/", | ||||
"api-1-vault-cook-gitfast", | "api-1-vault-cook-gitfast", | ||||
methods=["GET", "POST"], | methods=["GET", "POST"], | ||||
throttle_scope="swh_vault_cooking", | throttle_scope="swh_vault_cooking", | ||||
never_cache=True, | never_cache=True, | ||||
) | ) | ||||
@api_doc("/vault/gitfast/", tags=["hidden"]) | @api_doc("/vault/gitfast/") | ||||
@format_docstring() | @format_docstring() | ||||
def api_vault_cook_gitfast(request, swhid): | def api_vault_cook_gitfast(request, swhid): | ||||
""" | """ | ||||
.. http:get:: /api/1/vault/gitfast/(swhid)/ | .. http:get:: /api/1/vault/gitfast/(swhid)/ | ||||
.. http:post:: /api/1/vault/gitfast/(swhid)/ | .. http:post:: /api/1/vault/gitfast/(swhid)/ | ||||
Request the cooking of a gitfast archive for a revision or check | Request the cooking of a gitfast archive for a revision or check | ||||
its cooking status. | its cooking status. | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
@api_route( | @api_route( | ||||
r"/vault/revision/(?P<rev_id>[0-9a-f]+)/gitfast/", | r"/vault/revision/(?P<rev_id>[0-9a-f]+)/gitfast/", | ||||
"api-1-vault-cook-revision_gitfast", | "api-1-vault-cook-revision_gitfast", | ||||
methods=["GET", "POST"], | methods=["GET", "POST"], | ||||
checksum_args=["rev_id"], | checksum_args=["rev_id"], | ||||
throttle_scope="swh_vault_cooking", | throttle_scope="swh_vault_cooking", | ||||
never_cache=True, | never_cache=True, | ||||
) | ) | ||||
@api_doc("/vault/revision/gitfast/", tags=["hidden"]) | @api_doc("/vault/revision/gitfast/", tags=["deprecated"]) | ||||
@format_docstring() | @format_docstring() | ||||
def api_vault_cook_revision_gitfast(request, rev_id): | def api_vault_cook_revision_gitfast(request, rev_id): | ||||
""" | """ | ||||
.. http:get:: /api/1/vault/revision/(rev_id)/gitfast/ | .. http:get:: /api/1/vault/revision/(rev_id)/gitfast/ | ||||
This endpoint was replaced by :http:get:`/api/1/vault/gitfast/` | This endpoint was replaced by :http:get:`/api/1/vault/gitfast/` | ||||
""" | """ | ||||
_, obj_id = query.parse_hash_with_algorithms_or_throws( | _, obj_id = query.parse_hash_with_algorithms_or_throws( | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def api_vault_fetch_revision_gitfast(request, swhid): | ||||
return response | return response | ||||
@api_route( | @api_route( | ||||
r"/vault/revision/(?P<rev_id>[0-9a-f]+)/gitfast/raw/", | r"/vault/revision/(?P<rev_id>[0-9a-f]+)/gitfast/raw/", | ||||
"api-1-vault-fetch-revision_gitfast", | "api-1-vault-fetch-revision_gitfast", | ||||
checksum_args=["rev_id"], | checksum_args=["rev_id"], | ||||
) | ) | ||||
@api_doc("/vault/revision_gitfast/raw/", tags=["hidden"]) | @api_doc("/vault/revision_gitfast/raw/", tags=["hidden", "deprecated"]) | ||||
def _api_vault_revision_gitfast_raw(request, rev_id): | def _api_vault_revision_gitfast_raw(request, rev_id): | ||||
""" | """ | ||||
.. http:get:: /api/1/vault/revision/(rev_id)/gitfast/raw/ | .. http:get:: /api/1/vault/revision/(rev_id)/gitfast/raw/ | ||||
This endpoint was replaced by :http:get:`/api/1/vault/gitfast/raw/` | This endpoint was replaced by :http:get:`/api/1/vault/gitfast/raw/` | ||||
""" | """ | ||||
rev_gitfast_raw_url = reverse( | rev_gitfast_raw_url = reverse( | ||||
"api-1-vault-fetch-gitfast", url_args={"swhid": f"swh:1:rev:{rev_id}"} | "api-1-vault-fetch-gitfast", url_args={"swhid": f"swh:1:rev:{rev_id}"} | ||||
) | ) | ||||
return redirect(rev_gitfast_raw_url) | return redirect(rev_gitfast_raw_url) |