Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CloWM S3-Proxy Service
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Computational Metagenomics
CloWM
CloWM S3-Proxy Service
Commits
85690533
Verified
Commit
85690533
authored
2 years ago
by
Daniel Göbel
Browse files
Options
Downloads
Patches
Plain Diff
Allow shorter bucket description as output
#45
parent
ac8cbbd4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/api/endpoints/buckets.py
+2
-0
2 additions, 0 deletions
app/api/endpoints/buckets.py
app/schemas/bucket.py
+6
-0
6 additions, 0 deletions
app/schemas/bucket.py
with
8 additions
and
0 deletions
app/api/endpoints/buckets.py
+
2
−
0
View file @
85690533
...
...
@@ -80,6 +80,7 @@ async def list_buckets(
1
for
obj
in
s3
.
Bucket
(
name
=
bucket
.
name
).
objects
.
all
()
if
not
obj
.
key
.
endswith
(
"
.s3keep
"
)
),
"
size
"
:
reduce
(
lambda
x
,
y
:
x
+
y
.
size
,
list
(
s3
.
Bucket
(
name
=
bucket
.
name
).
objects
.
all
()),
0
),
"
owner_constraint
"
:
bucket
.
owner_constraint
,
}
)
for
bucket
in
buckets
...
...
@@ -215,6 +216,7 @@ async def get_bucket(
"
owner
"
:
bucket
.
owner_id
,
"
num_objects
"
:
sum
(
1
for
obj
in
objects
if
not
obj
.
key
.
endswith
(
"
.s3keep
"
)),
"
size
"
:
reduce
(
lambda
x
,
y
:
x
+
y
.
size
,
objects
,
0
),
"
owner_constraint
"
:
bucket
.
owner_constraint
,
}
)
...
...
This diff is collapsed.
Click to expand it.
app/schemas/bucket.py
+
6
−
0
View file @
85690533
from
datetime
import
datetime
from
typing
import
TYPE_CHECKING
from
clowmdb.models
import
Bucket
from
pydantic
import
BaseModel
,
Field
if
TYPE_CHECKING
:
...
...
@@ -53,6 +54,11 @@ class BucketOut(_BaseBucket):
owner
:
str
=
Field
(...,
description
=
"
UID of the owner
"
,
example
=
"
28c5353b8bb34984a8bd4169ba94c606
"
)
num_objects
:
int
=
Field
(...,
description
=
"
Number of Objects in this bucket
"
,
example
=
6
)
size
:
int
=
Field
(...,
description
=
"
Total size of objects in this bucket in bytes
"
,
example
=
3256216
)
owner_constraint
:
Bucket
.
Constrain
|
None
=
Field
(
None
,
description
=
"
Constraint for the owner of the bucket
"
)
description
:
str
=
Field
(
...,
description
=
"
Description of the bucket
"
,
)
class
Config
:
orm_mode
=
True
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment