osf.io
osf.io copied to clipboard
[ENG-2247] Creates a Node quota_status v1 endpoint for WB to enforce storage limits
Purpose
Provides Waterbutler with an endpoint to check if a node has exceeded storage limits prior to conducting file operations
Changes
- Adds an endpoint (
api/v1/<guid>/osfstorage/quota_status/
) for WB to check theover_quota
status of a node - Adds tests for the new endpoint
QA Notes
Dev Tested (Endpoint can only be accessed by WB)
Documentation
N/A
Side Effects
N/A
Ticket
Drive-by: Did you mean to include your other API PR in with this one?
I rebased this PR upon the other API PR because of some of the None
storage_usage
handling and re-numbering of the StorageEnum.
@Johnetordoff Some of your feedback is actually for https://github.com/CenterForOpenScience/osf.io/pull/9483 (which this PR is based upon). I'll incorporate those changes there.
We'll talk about why a distinct endpoint is necessary for WB tomorrow and I can write up a Notion doc detailing why - the gist is that get_auth is sent on an operation basis rather than a user intent basis (i.e. A user-facing move is two file operations, an upload and delete). For certain moves/copies within the same OSFStorage instance, they should be allowed regardless of storage caps because they are internal and not increasing the storage used. Permitting these operations through get_auth
is difficult because the get_auth calls for the underlying file operations are independent. I believe we identified a way it could be managed but it was ultimately decided that the additional flexibility of a distinct endpoint would be better.
Excellent work! just address Fitz's comments and we good.