An API for Guichet #23

Merged
quentin merged 14 commits from api into main 2023-09-26 06:44:36 +00:00
Showing only changes of commit e876bdd663 - Show all commits

29
api.go
View file

@ -118,6 +118,35 @@ func handleAPIGarageBucket(w http.ResponseWriter, r *http.Request) {
return
}
// CHECK PATCH REQUEST
// READ BODY JSON
// VALIDATE OBJECT
// --- bucket query parameter ---
// 1. bucket must be owned by the key with owner permission, otherwise throw "unauthorized" (401)
// 2. must not end with deuxfleurs.fr or deuxfleurs.org, otherwise throw "forbidden" (403)
// --- global ---
// 1. can be true, false, or nil (use pointers)
// 2. if nil do nothing
// 3. if false, throw "not yet implemented" (501)
// 4. if true, check that the bucket name does not exist yet in the global namespace, throw "forbidden" (403)
// --- quota.size ---
// 1. if no quota on the bucket + this field is none, set to 50MB
// 2. if lower than 50MB, set to 50MB. If higher than 200MB, set to 200MB
// --- quota.files ---
// 1. if no quota on the bucket + this field is none, set to 10k
// 2. if lower than 10k, set to 10k. If higher than 40k, set to 40k
// IF BODY.GLOBAL is not NONE
// Add an alias
// IF BODY.QUOTA.SIZE is not NONE
// Change quota
// IF BODY.QUOTA.FILE is not NONE
// Change quota
log.Println(login, s3key)
return