wip: workload layout

This commit is contained in:
A.Unger
2021-10-07 12:54:13 +02:00
parent 16dcc4fadb
commit 9299e22b18

View File

@@ -2,6 +2,7 @@ package svc
import (
"net/http"
"strings"
"github.com/owncloud/ocis/ocis-pkg/account"
opkgm "github.com/owncloud/ocis/ocis-pkg/middleware"
@@ -60,6 +61,33 @@ func NewService(opts ...Option) Service {
)
r.Post("/", svc.CreateDrive)
})
r.Route("/Drive({id})", func(r chi.Router) {
r.Use(opkgm.ExtractAccountUUID(
account.Logger(options.Logger),
account.JWTSecret(options.Config.TokenManager.JWTSecret)),
)
r.Patch("/", func(w http.ResponseWriter, r *http.Request) {
d := strings.ReplaceAll(chi.URLParam(r, "id"), `"`, "")
/*
1. get storage space by id
2. prepare UpdateStorageSpaceRequest
3. get a reva client
4. do UpdateStorageSpace request
Known loose ends:
1. Reva's FS interface does not yet contain UpdateStorageSpace. Needs to be added.
2. There are many ways to select a resource on OData. Because spaces names are not unique, we will support
unique updates and not bulk updates. Supported URLs look like:
https://localhost:9200/graph/v1.0/DriveById(id=1284d238-aa92-42ce-bdc4-0b0000009157!cdf8d353-dd02-46ed-b06a-3bb66f29743c)
3. How are uploading images to the space being handled? Since an image is not a property of the Drive (speaking OData)
it can be handled directly by doing an upload to the storage itself.
*/
_, _ = w.Write([]byte(d))
w.WriteHeader(http.StatusOK)
})
})
})
})