Bulk endpoint for working with resources
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
craton |
Confirmed
|
High
|
Unassigned |
Bug Description
For both setting and getting resources, including their variables, it can be valuable to provide a bulk resources endpoint.
Presumably this is not an antipattern for REST APIs. Regardless, it still is very useful for real usage.
One possible schema starts with something like this payload for setting the values of resources in the Craton API server, which then constructs the corresponding object graph; and serializes it to the database.
[{resource_type: <type>, resource_id: <id>, [attribute: value]*, variables: <json>}, ...]
Perhaps this can be done via JSON PATCH? A good design that meets this bulk usage is what we need; design is flexible as long as it is reasonably easy for client usage to build the necessary payload. Other questions include making this a general update mechanism, so variables/
Lastly most bulk loads like this for databases are done in a sequence of batch updates. Similarly, this should be retrievable via pagination. Standard queries should apply for getting such resources as well; eg, via a region, label, var search, etc.
See discussion starting here:
http://
Changed in craton: | |
assignee: | nobody → Thomas Maddox (thomas-maddox) |
Changed in craton: | |
status: | In Progress → Confirmed |
Changed in craton: | |
assignee: | Thomas Maddox (thomas-maddox) → nobody |
We can also use this to remove the existing ansible-inventory endpoint: we can push its functionality for building the Ansible formatting specifics into client code, while retaining its functionality for bulk reads out of the db.