Refactor and standardize how files are added to playbooks

Files are now (once again) related to playbooks.
We expect the playbook to be created first and then it's files are
created and associated to it.

- the /api/v1/playbook/<id>/files endpoint was removed
- the playbook id is now required when doing a POST on /api/v1/files
- playbook.file referenced a file object and no longer exists.
- playbook.file was replaced by "path" which is the path for the playbook
  file.
- playbook.files still exists but, from an API standpoint, this means
  that to find the files associated to a playbook, we can now do
  something like:

    "/api/v1/files?playbook=%s" % playbook.id

To find the playbook file itself, we can do something like:

    "/api/v1/files?playbook=%s&path=%s" % (playbook.id, playbook.path)

Change-Id: Id51129757e1626313caee4005b081027e5694aba
This commit is contained in:
David Moreau Simard
2018-12-18 12:04:10 -05:00
parent fdcc003fd9
commit 2bd8c3f654
10 changed files with 83 additions and 157 deletions

View File

@@ -3,7 +3,6 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0
Django>=2
djangorestframework
django-cors-headers
drf-extensions
django-filter
django-environ
dynaconf