Task #2823
Updated by mhrivnak over 7 years ago
Recent work has concluded that we can use drf-nested-routers to have nested paths in Pulp 3. https://github.com/alanjds/drf-nested-routers/ This task is to: - introduce a dependency on the above library - nest importers and publishers under the path for individual repositories as shown below - rework the flow [0] of viewsets being registered to the DRF router, given that there will now be multiple routers Since we need to support nesting with the master/detail approach, importers and publishers make a natural starting point for nesting. Paths will look like this: <pre> /api/v3/repositories/ /api/v3/repositories/<repo_name>/ /api/v3/repositories/<repo_name>/importers/<type>/ /api/v3/repositories/<repo_name>/importers/<type>/<importer_id>/ </pre> As an example, if you had a repo with name "r1" and a file importer with name "i1", and you were to <pre> GET http://192.168.121.135:8000/api/v3/repositories/r1/ </pre> you would see <pre><code class="json"> { "_href": "http://192.168.121.135:8000/api/v3/repositories/r1/", "description": "", "notes": {}, "scratchpad": {}, "last_content_added": null, "last_content_removed": null, "importers": [ "http://192.168.121.135:8000/api/v3/repositories/r1/importers/file/i1/" ], "publishers": [], "content": "http://192.168.121.135:8000/api/v3/repositories/r1/content/" } </code></pre> Or if you <pre> GET http://192.168.121.135:8000/api/v3/repositories/r1/importers/file/ </pre> you would see all importers of type file: <pre><code class="json"> [ { "_href": "http://192.168.121.135:8000/api/v3/repositories/r1/importers/file/i1/", "type": "file", "name": "i1", "last_updated": "2017-06-08T03:00:53.361829Z", "feed_url": "", "validate": true, "ssl_validation": true, "proxy_url": "", "download_policy": "", "last_sync": null, "repository": "http://192.168.121.135:8000/api/v3/repositories/r1/" } ] </code></pre> [0] https://github.com/pulp/pulp/blob/64741860/platform/pulpcore/app/urls.py#L20