-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manage Spaces Attributes #2588
Merged
Merged
Manage Spaces Attributes #2588
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9299e22
wip: workload layout
refs c0ae065
account for space description
refs 8161f90
wip: prepare update request
refs 4466e6b
proper url parsing using godata
refs 4861372
add docs for editing a Space
refs dff70e0
add docs for editing a Space
refs 386847a
use TrimPrefix instead of TrimLeft
refs 052b25e
trigger-sonarcloud
refs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
title: "Spaces" | ||
date: 2020-04-27T18:46:00+01:00 | ||
weight: 38 | ||
geekdocRepo: https://github.com/owncloud/ocis | ||
geekdocEditPath: edit/master/docs/extensions/storage | ||
geekdocFilePath: spaces.md | ||
--- | ||
|
||
{{< toc >}} | ||
|
||
## Editing a Storage Space | ||
|
||
The OData specification allows for a mirage of ways of addressing an entity. We will support addressing a Drive entity by its unique identifier, which is the one the graph-api returns when listing spaces, and its format is: | ||
|
||
```json | ||
{ | ||
"id": "1284d238-aa92-42ce-bdc4-0b0000009157!b6e2c9cc-9dbe-42f0-b522-4f2d3e175e9c" | ||
} | ||
``` | ||
|
||
This is an extract of an element of the list spaces response. An entire object has the following shape: | ||
|
||
```json | ||
{ | ||
"driveType": "project", | ||
"id": "1284d238-aa92-42ce-bdc4-0b0000009157!b6e2c9cc-9dbe-42f0-b522-4f2d3e175e9c", | ||
"lastModifiedDateTime": "2021-10-07T11:06:43.245418+02:00", | ||
"name": "marketing", | ||
"owner": { | ||
"user": { | ||
"id": "ddc2004c-0977-11eb-9d3f-a793888cd0f8" | ||
} | ||
}, | ||
"quota": { | ||
"total": 65536 | ||
}, | ||
"root": { | ||
"id": "1284d238-aa92-42ce-bdc4-0b0000009157!b6e2c9cc-9dbe-42f0-b522-4f2d3e175e9c", | ||
"webDavUrl": "https://localhost:9200/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157!b6e2c9cc-9dbe-42f0-b522-4f2d3e175e9c" | ||
} | ||
} | ||
``` | ||
|
||
### Updating a space property | ||
|
||
Having introduced the above, one can refer to a Drive with the following URL format: | ||
|
||
```console | ||
'https://localhost:9200/graph/v1.0/Drive(1284d238-aa92-42ce-bdc4-0b0000009157!07c26b3a-9944-4f2b-ab33-b0b326fc7570") | ||
``` | ||
|
||
Udating an entity attribute: | ||
|
||
```console | ||
curl -X PATCH 'https://localhost:9200/graph/v1.0/Drive("1284d238-aa92-42ce-bdc4-0b0000009157!07c26b3a-9944-4f2b-ab33-b0b326fc7570)' -d '{"name":"42"}' -v | ||
``` | ||
|
||
The previous URL resource path segment (`Drive(1284d238-aa92-42ce-bdc4-0b0000009157!07c26b3a-9944-4f2b-ab33-b0b326fc7570)`) is parsed and handed over to the storage registry in order to apply the patch changes in the body, in this case update the space name attribute to `42`. Since space names are not unique we only support addressing them by their unique identifiers, any other query would render too ambiguous and explode in complexity. | ||
|
||
|
||
### Updating a space description | ||
|
||
Since every space is the root of a webdav directory, following some conventions we can make use of this to set a default storage description and image. In order to do so, every space is created with a hidden `.space` folder at its root, which can be used to store such data. | ||
|
||
```curl | ||
curl -k -X PUT https://localhost:9200/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157\!07c26b3a-9944-4f2b-ab33-b0b326fc7570/.space/description.md -d "Add a description to your spaces" -u admin:admin | ||
``` | ||
|
||
Verify the description was updated: | ||
|
||
```curl | ||
❯ curl -k https://localhost:9200/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157\!07c26b3a-9944-4f2b-ab33-b0b326fc7570/.space/description.md -u admin:admin | ||
Add a description to your spaces | ||
``` | ||
|
||
This feature makes use of the internal storage layout and is completely abstracted from the end user. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add quota? Setting quota on create already works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not part of the acceptance criteria