Project

Profile

Help

Task #2823

closed

In the REST API, nest importers and publishers under the repositories path

Added by mhrivnak almost 7 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Sprint:
Sprint 22
Quarter:

Description

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:

/api/v3/repositories/
/api/v3/repositories/<repo_name>/
/api/v3/repositories/<repo_name>/importers/<type>/
/api/v3/repositories/<repo_name>/importers/<type>/<importer_name>/

As an example, if you had a repo with name "r1" and a file importer with name "i1", and you were to

GET http://192.168.121.135:8000/api/v3/repositories/r1/

you would see

{
    "_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/"
}

Or if you

GET http://192.168.121.135:8000/api/v3/repositories/r1/importers/file/

you would see all importers of type file:

[
    {
        "_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/"
    }
]

[0] https://github.com/pulp/pulp/blob/64741860/platform/pulpcore/app/urls.py#L20

Also available in: Atom PDF