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

Actions #1

Updated by mhrivnak almost 7 years ago

  • Description updated (diff)
Actions #2

Updated by amacdona@redhat.com almost 7 years ago

I would also like to see `/v3/repositories/importers/`, though I am not sure if it would be appropriate to add here or not.

This should do something like list the <types>, or links to them.

Actions #3

Updated by amacdona@redhat.com almost 7 years ago

Are there any other URLs that might need to use nesting? It might be worth listing them before we get started on this. In particular, I am wondering if there are nested URLs that will not be nested under repositories.

Actions #4

Updated by mhrivnak almost 7 years ago

I agree the "importers/" endpoint would be nice. The master-detail pattern doesn't make that easy, but maybe we could figure a way to add it. That said, I don't think it's required.

If we did have it, I'd suggest it should return representations of each importer regardless of type.

There will be other nested paths. Here are ones I can think of as likely possibilities. The consumer ones of course are contingent on what our applicability plan will be, but I think it's a reasonable bet that we'll continue doing it as part of Pulp.

/api/v3/repositories/<repo_name>/versions/
/api/v3/repositories/<repo_name>/versions/<version_number>/content/
/api/v3/consumers/<consumer_name>/bindings/
/api/v3/content/<content_type>/<identifier>/catalog_entries/
/api/v3/tasks/<task_id>/progress_reports/
Actions #5

Updated by amacdona@redhat.com almost 7 years ago

For these:

/api/v3/repositories/<repo_name>/versions/
/api/v3/consumers/<consumer_name>/bindings/
/api/v3/tasks/<task_id>/progress_reports/

We don't really need true "nested URLs". These can all be implemented directly on the ViewSet as a detail route:

https://github.com/pulp/pulp/blob/3.0-dev/platform/pulpcore/app/viewsets/repository.py#L33

Actions #6

Updated by mhrivnak almost 7 years ago

Good point. However, in any case where we want more than just a read-only list of resources, then we need more than just the detail route. If you want to get a specific resource in the collection, add one, remove one, modify one, or otherwise take action on one, then we need real nesting. I think that is the case for most or all of these nested collections.

Actions #7

Updated by mhrivnak almost 7 years ago

  • Subject changed from [WIP] in REST API, nest importers and publishers under repositories path to In the REST API, nest importers and publishers under the repositories path
Actions #8

Updated by amacdona@redhat.com almost 7 years ago

  • Groomed changed from No to Yes
  • Sprint Candidate changed from No to Yes
Actions #9

Updated by mhrivnak almost 7 years ago

  • Sprint/Milestone set to 41
Actions #10

Updated by mhrivnak almost 7 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to mhrivnak
Actions #11

Updated by mhrivnak almost 7 years ago

  • Description updated (diff)
Actions #12

Updated by mhrivnak almost 7 years ago

  • Status changed from ASSIGNED to POST

Added by mhrivnak almost 7 years ago

Revision ca8f6390 | View on GitHub

Nests importer and publisher REST API paths under repositories

https://pulp.plan.io/issues/2823 closes #2823

Added by mhrivnak almost 7 years ago

Revision ca8f6390 | View on GitHub

Nests importer and publisher REST API paths under repositories

https://pulp.plan.io/issues/2823 closes #2823

Actions #13

Updated by mhrivnak almost 7 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #14

Updated by bmbouter about 6 years ago

  • Sprint set to Sprint 22
Actions #15

Updated by bmbouter about 6 years ago

  • Sprint/Milestone deleted (41)
Actions #16

Updated by daviddavis almost 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #17

Updated by bmbouter almost 5 years ago

  • Tags deleted (Pulp 3)
Actions #18

Updated by bmbouter over 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF