Story #4279
closedNamespace plugin endpoints for viewsets of master/detail models.
100%
Description
At the moment plugins specify the plugin name or some identifier to namespace their endpoints manually as a part of endpoint_name
when they write their viewsets,
e.g. for PackageViewSet
: endpoint_name = 'rpm/packages'
, for UpdateRecordViewSet
: endpoint_name = 'rpm/errata'
, etc.
Currently it's mostly a problem for ContentViewSets and less of a problem for Remotes, Publishers, etc, since it's common for a single plugin to support multiple content types.
The suggestion is to prepend endpoint_name of a viewset of any detail model automagically with a plugin name which is defined as a Django app label.
For the plugins it is recommended to drop the 'pulp_' part of their Django app label.
E.g.: For PackageViewSet
: endpoint_name
will be 'packages'
, and the Django label will change "pulp_rpm" -> "rpm", so for there is no change in content endpoints:
/api/v3/content/rpm/packages/
Remotes'/Publishers'/other "detail" endpoints will change this way (first "rpm" is a Django label, second "rpm" is endpoint_name
defined on a viewset):
/api/v3/remotes/rpm/ --> /api/v3/content/remotes/rpm/rpm/
/api/v3/publishers/rpm/ --> /api/v3/content/publishers/rpm/rpm/
Namespace plugin endpoints with Django app label
closes #4279 https://pulp.plan.io/issues/4279
Required PR: https://github.com/pulp/pulp_file/pull/157