dservercore 0.20.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dservercore/cli.py ADDED
@@ -0,0 +1,268 @@
1
+ """Command line utility functions."""
2
+
3
+ import json
4
+ import sys
5
+
6
+ import click
7
+ import dtoolcore
8
+ import dtoolcore.utils
9
+ from flask import Flask, current_app
10
+ from flask.cli import AppGroup
11
+ from flask_jwt_extended import create_access_token
12
+
13
+ from dtoolcore import iter_datasets_in_base_uri, DataSet
14
+ import dservercore
15
+ import dservercore.utils
16
+ from dservercore.utils import (
17
+ base_uri_exists,
18
+ user_exists,
19
+ delete_users,
20
+ register_users,
21
+ update_users,
22
+ register_base_uri,
23
+ get_permission_info,
24
+ register_permissions,
25
+ register_dataset,
26
+ generate_dataset_info,
27
+ obj_to_dict,
28
+ versions_to_dict
29
+ )
30
+ from dservercore.config import CONFIG_EXCLUSIONS
31
+
32
+ app = Flask(__name__)
33
+
34
+ user_cli = AppGroup("user", help="User management commands.")
35
+ base_uri_cli = AppGroup("base_uri", help="Base URI management commands.")
36
+ dataset_cli = AppGroup("dataset", help="Dataset index management commands.")
37
+ config_cli = AppGroup("config", help="Config inspection commands.")
38
+
39
+
40
+ @user_cli.command(name="add")
41
+ @click.argument("username")
42
+ @click.option("-a", "--is_admin", is_flag=True)
43
+ def register_user(username, is_admin):
44
+ """Register a user in dserver."""
45
+
46
+ if user_exists(username):
47
+ click.secho("User '{}' already registered".format(username), fg="red", err=True)
48
+ sys.exit(1)
49
+
50
+ users = [{"username": username, "is_admin": is_admin}]
51
+ register_users(users)
52
+
53
+
54
+ @user_cli.command(name="update")
55
+ @click.argument("username")
56
+ @click.option("-a", "--is_admin", is_flag=True)
57
+ def update_user(username, is_admin):
58
+ """Update a user in dserver."""
59
+
60
+ if not user_exists(username):
61
+ click.secho(
62
+ "User '{}' is not registered yet".format(username), fg="red", err=True
63
+ )
64
+ sys.exit(1)
65
+
66
+ users = [{"username": username, "is_admin": is_admin}]
67
+ update_users(users)
68
+
69
+
70
+ @user_cli.command(name="delete")
71
+ @click.argument("username")
72
+ def delete_user(username):
73
+ """Delete a user in dserver."""
74
+ users = [
75
+ {
76
+ "username": username,
77
+ }
78
+ ]
79
+ delete_users(users)
80
+
81
+
82
+ @user_cli.command(name="list")
83
+ def list_users():
84
+ """List the users in dserver."""
85
+ click.secho(json.dumps(dservercore.utils.list_users(), indent=2))
86
+
87
+
88
+ @base_uri_cli.command(name="add")
89
+ @click.argument("base_uri")
90
+ def add_base_uri(base_uri):
91
+ """Register a base URI in dserver."""
92
+ base_uri = dtoolcore.utils.sanitise_uri(base_uri)
93
+ if base_uri_exists(base_uri):
94
+ click.secho(
95
+ "Base URI '{}' already registered".format(base_uri), fg="red", err=True
96
+ )
97
+ sys.exit(1)
98
+
99
+ register_base_uri(base_uri)
100
+
101
+
102
+ @base_uri_cli.command(name="list")
103
+ def list_base_uris():
104
+ """List the base URIs in dserver."""
105
+ click.secho(json.dumps(dservercore.utils.list_base_uris(), indent=2))
106
+
107
+
108
+ @user_cli.command(name="search_permission")
109
+ @click.argument("username")
110
+ @click.argument("base_uri")
111
+ def give_search_permission(username, base_uri):
112
+ """Give a user search permission on a base URI."""
113
+
114
+ if not base_uri_exists(base_uri):
115
+ click.secho("Base URI '{}' not registered".format(base_uri), fg="red", err=True)
116
+ sys.exit(1)
117
+
118
+ if not user_exists(username):
119
+ click.secho("User '{}' not registered".format(username), fg="red", err=True)
120
+ sys.exit(1)
121
+
122
+ permissions = get_permission_info(base_uri)
123
+
124
+ if username in permissions["users_with_search_permissions"]:
125
+ click.secho(
126
+ "User '{}' already has search permissions".format(username),
127
+ fg="red",
128
+ err=True,
129
+ )
130
+ sys.exit(1)
131
+
132
+ permissions["users_with_search_permissions"].append(username)
133
+ register_permissions(base_uri, permissions)
134
+
135
+
136
+ @user_cli.command(name="register_permission")
137
+ @click.argument("username")
138
+ @click.argument("base_uri")
139
+ def give_register_permission(username, base_uri):
140
+ """Give a user register permission on a base URI."""
141
+
142
+ if not base_uri_exists(base_uri):
143
+ click.secho("Base URI '{}' not registered".format(base_uri), fg="red", err=True)
144
+ sys.exit(1)
145
+
146
+ if not user_exists(username):
147
+ click.secho("User '{}' not registered".format(username), fg="red", err=True)
148
+ sys.exit(1)
149
+
150
+ permissions = get_permission_info(base_uri)
151
+
152
+ if username in permissions["users_with_register_permissions"]:
153
+ click.secho(
154
+ "User '{}' already has register permissions".format(username),
155
+ fg="red",
156
+ err=True,
157
+ )
158
+ sys.exit(1)
159
+
160
+ permissions["users_with_register_permissions"].append(username)
161
+ register_permissions(base_uri, permissions)
162
+
163
+
164
+ @user_cli.command(name="token")
165
+ @click.argument("username")
166
+ @click.option("--last-forever", is_flag=True)
167
+ def generate_token(username, last_forever):
168
+ """Generate a token for a user in dserver."""
169
+
170
+ if not user_exists(username):
171
+ click.secho("User '{}' not registered".format(username), fg="red", err=True)
172
+ sys.exit(1)
173
+
174
+ if last_forever:
175
+ token = create_access_token(identity=username, expires_delta=False)
176
+ else:
177
+ token = create_access_token(identity=username)
178
+ try:
179
+ # Python 2.
180
+ click.secho(token.decode("utf-8"))
181
+ except AttributeError:
182
+ # Python 3
183
+ click.secho(token)
184
+
185
+
186
+ @base_uri_cli.command(name="index")
187
+ @click.argument("base_uri")
188
+ def index_base_uri(base_uri):
189
+ """Register all the datasets in a base URI."""
190
+ base_uri = dtoolcore.utils.sanitise_uri(base_uri)
191
+
192
+ if not base_uri_exists(base_uri):
193
+ click.secho("Base URI '{}' not registered".format(base_uri), fg="red", err=True)
194
+ sys.exit(1)
195
+
196
+ for dataset in iter_datasets_in_base_uri(base_uri):
197
+ try:
198
+ dataset_info = generate_dataset_info(dataset, base_uri)
199
+ except Exception as message:
200
+ click.secho(
201
+ "Failed to register: {} {}".format(dataset.name, dataset.uri), fg="red"
202
+ )
203
+ click.echo(message)
204
+ continue
205
+
206
+ try:
207
+ r = register_dataset(dataset_info)
208
+ except dservercore.ValidationError as message:
209
+ click.secho(
210
+ "Failed to register: {} {}".format(dataset.name, dataset.uri), fg="red"
211
+ )
212
+ click.echo(message)
213
+ continue
214
+
215
+ click.secho("Registered: {}".format(r), fg="green")
216
+
217
+
218
+ @dataset_cli.command(name="register")
219
+ @click.argument("uri")
220
+ def register(uri):
221
+ """Register specific dataset at URI."""
222
+ uri = dtoolcore.utils.sanitise_uri(uri)
223
+
224
+ dataset = DataSet.from_uri(uri)
225
+ base_uri = dataset.base_uri
226
+
227
+ if not base_uri_exists(base_uri):
228
+ click.secho("Base URI '{}' not registered".format(base_uri), fg="red", err=True)
229
+ sys.exit(1)
230
+
231
+ try:
232
+ dataset_info = generate_dataset_info(dataset, base_uri)
233
+ except Exception as message:
234
+ click.secho(
235
+ "Failed to register: {} {}".format(dataset.name, dataset.uri), fg="red", err=True
236
+ )
237
+ click.echo(message, err=True)
238
+ sys.exit(1)
239
+
240
+ try:
241
+ r = register_dataset(dataset_info)
242
+ except dservercore.ValidationError as message:
243
+ click.secho(
244
+ "Failed to register: {} {}".format(dataset.name, dataset.uri), fg="red", err=True
245
+ )
246
+ click.echo(message, err=True)
247
+ sys.exit(1)
248
+
249
+ click.secho("Registered: {}".format(r), fg="green")
250
+
251
+
252
+ @config_cli.command(name="show")
253
+ def config_show():
254
+ """Print JSON-formatted Flask app config."""
255
+ publishable_config = obj_to_dict(current_app.config, exclusions=CONFIG_EXCLUSIONS)
256
+ click.secho(json.dumps(publishable_config, indent=2))
257
+
258
+
259
+ @config_cli.command(name="versions")
260
+ def config_versions():
261
+ """Print JSON-formatted lookup server components and versions."""
262
+ click.secho(json.dumps(versions_to_dict(), indent=2))
263
+
264
+
265
+ app.cli.add_command(user_cli)
266
+ app.cli.add_command(base_uri_cli)
267
+ app.cli.add_command(dataset_cli)
268
+ app.cli.add_command(config_cli)
dservercore/config.py ADDED
@@ -0,0 +1,98 @@
1
+ """dserver Flask app configuration"""
2
+ import json
3
+ import os
4
+
5
+ import dservercore
6
+
7
+ _HERE = os.path.abspath(os.path.dirname(__file__))
8
+
9
+ # config parameters to exclude from any config dump
10
+ CONFIG_EXCLUSIONS = [
11
+ "JWT_PRIVATE_KEY",
12
+ "SECRET_KEY",
13
+ "SQLALCHEMY_DATABASE_URI",
14
+ ]
15
+
16
+
17
+ def _get_file_content(key, default=""):
18
+ file_path = os.environ.get(key, "")
19
+ if os.path.isfile(file_path):
20
+ content = open(file_path).read()
21
+ else:
22
+ content = ""
23
+ return content
24
+
25
+
26
+ class Config(object):
27
+ CONFIG_SECRETS_TO_OBFUSCATE = CONFIG_EXCLUSIONS
28
+
29
+ SECRET_KEY = os.environ.get("SECRET_KEY", "you-will-never-guess")
30
+ SQLALCHEMY_DATABASE_URI = os.environ.get(
31
+ "SQLALCHEMY_DATABASE_URI",
32
+ "sqlite:///{}".format(os.path.join(_HERE, "..", "app.db")),
33
+ )
34
+ SQLALCHEMY_TRACK_MODIFICATIONS = False
35
+
36
+ JWT_ALGORITHM = "RS256"
37
+ JWT_TOKEN_LOCATION = "headers"
38
+ JWT_HEADER_NAME = "Authorization"
39
+ JWT_HEADER_TYPE = "Bearer"
40
+
41
+ # Logic to give "JWT_PUBLIC_KEY" priority over "JWT_PUBLIC_KEY_FILE".
42
+ # This is used when making use of JWT tokens generated by another service.
43
+ # Hence there is no need for the JWT_PRIVATE_KEY_FILE.
44
+ if os.environ.get("JWT_PUBLIC_KEY"):
45
+ JWT_PUBLIC_KEY = os.environ.get("JWT_PUBLIC_KEY")
46
+ else:
47
+ JWT_PRIVATE_KEY = _get_file_content("JWT_PRIVATE_KEY_FILE")
48
+ JWT_PUBLIC_KEY = _get_file_content("JWT_PUBLIC_KEY_FILE")
49
+
50
+ JSONIFY_PRETTYPRINT_REGULAR = True
51
+
52
+ API_TITLE = "dserver API"
53
+ API_VERSION = "v1"
54
+
55
+ # flask_smorest.Blueprint.paginate embeds pagination information like
56
+ # {
57
+ # 'total': 1000, 'total_pages': 200,
58
+ # 'page': 2, 'first_page': 1, 'last_page': 200,
59
+ # 'previous_page': 1, 'next_page': 3,
60
+ # }
61
+ # in the response header 'X-Pagination', see
62
+ # https://flask-smorest.readthedocs.io/en/latest/pagination.html#pagination-header
63
+ # To make client request frameworks like axios expose these data to the
64
+ # actual app, e.g. the dtool-lookup-webapp, the server needs to indicate
65
+ # the wish to do so, see
66
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
67
+ # With flask, this is achieved by configuring flask-cors as follows, see
68
+ # https://flask-cors.readthedocs.io/en/latest/configuration.html#configuration-options
69
+ CORS_EXPOSE_HEADERS = ["X-Pagination"]
70
+
71
+ OPENAPI_VERSION = "3.0.2"
72
+ OPENAPI_URL_PREFIX = os.environ.get("OPENAPI_URL_PREFIX", "/doc")
73
+ OPENAPI_REDOC_PATH = os.environ.get("OPENAPI_REDOC_PATH", "/redoc")
74
+ OPENAPI_REDOC_URL = os.environ.get("OPENAPI_REDOC_URL",
75
+ "https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"
76
+ )
77
+ OPENAPI_SWAGGER_UI_PATH = os.environ.get("OPENAPI_SWAGGER_UI_PATH", "/swagger")
78
+ OPENAPI_SWAGGER_UI_URL = os.environ.get("OPENAPI_SWAGGER_UI_URL", "https://cdn.jsdelivr.net/npm/swagger-ui-dist/")
79
+
80
+ # give API_SPEC_OPTIONS priority over API_SPEC_OPTIONS_FILE over default value
81
+ if os.environ.get("API_SPEC_OPTIONS"):
82
+ API_SPEC_OPTIONS = json.loads(os.environ.get("API_SPEC_OPTIONS"))
83
+ elif os.environ.get("API_SPEC_OPTIONS_FILE"):
84
+ API_SPEC_OPTIONS = json.loads(_get_file_content("API_SPEC_OPTIONS_FILE"))
85
+ else:
86
+ API_SPEC_OPTIONS = {
87
+ "x-internal-id": "2",
88
+ "security": [{"bearerAuth": []}],
89
+ "components": {
90
+ "securitySchemes": {
91
+ "bearerAuth": {
92
+ "type": "http",
93
+ "scheme": "bearer",
94
+ "bearerFormat": "JWT"
95
+ }
96
+ }
97
+ }
98
+ }
@@ -0,0 +1,47 @@
1
+ """Routes for retrieving server and server-side plugin configuration"""
2
+ from flask import (
3
+ abort,
4
+ current_app,
5
+ jsonify,
6
+ )
7
+
8
+ from flask_jwt_extended import (
9
+ jwt_required,
10
+ get_jwt_identity,
11
+ )
12
+
13
+ import dservercore
14
+ import dservercore.utils_auth
15
+ from dservercore.blueprint import Blueprint
16
+ from dservercore.schemas import ConfigSchema, VersionSchema
17
+ from dservercore.utils import versions_to_dict, obj_to_lowercase_key_dict
18
+
19
+
20
+ bp = Blueprint("config", __name__, url_prefix="/config")
21
+
22
+
23
+ @bp.route("/info", methods=["GET"])
24
+ @bp.response(200, ConfigSchema)
25
+ @bp.alt_response(401, description="Not registered")
26
+ @jwt_required()
27
+ def server_config():
28
+ """Return the JSON-serialized Flask app configuration."""
29
+
30
+ username = get_jwt_identity()
31
+ if not dservercore.utils_auth.user_exists(username):
32
+ # Unregistered users should see 401.
33
+ abort(401)
34
+
35
+ return jsonify({"config": obj_to_lowercase_key_dict(
36
+ current_app.config,
37
+ exclusions=current_app.config["CONFIG_SECRETS_TO_OBFUSCATE"])})
38
+
39
+
40
+ @bp.route("/versions", methods=["GET"])
41
+ @bp.response(200, VersionSchema)
42
+ def server_versions():
43
+ """Return the JSON-serialized server component versions.
44
+
45
+ This does not require authorization."""
46
+
47
+ return jsonify({"versions": versions_to_dict()})
@@ -0,0 +1,22 @@
1
+ """Validation utility functions."""
2
+
3
+ from datetime import datetime
4
+
5
+
6
+ def extract_created_at_as_datetime(admin_metadata):
7
+ """Return created_at as datetime
8
+ Use frozen_at if created_at is missing.
9
+ Deal with some created_at values being strings.
10
+ """
11
+ try:
12
+ created_at = admin_metadata["created_at"]
13
+ except KeyError:
14
+ created_at = admin_metadata["frozen_at"]
15
+ created_at = float(created_at)
16
+ return datetime.utcfromtimestamp(created_at)
17
+
18
+
19
+ def extract_frozen_at_as_datetime(admin_metadata):
20
+ frozen_at = admin_metadata["frozen_at"]
21
+ frozen_at = float(frozen_at)
22
+ return datetime.utcfromtimestamp(frozen_at)
@@ -0,0 +1,8 @@
1
+ """Flask extensions"""
2
+ from flask_sqlalchemy import SQLAlchemy
3
+ from flask_marshmallow import Marshmallow
4
+ from flask_jwt_extended import JWTManager
5
+
6
+ sql_db = SQLAlchemy()
7
+ jwt = JWTManager()
8
+ ma = Marshmallow()
@@ -0,0 +1,49 @@
1
+ """Route for retrieving the manifest of a dataset"""
2
+ from flask import (
3
+ abort,
4
+ jsonify,
5
+ current_app
6
+ )
7
+ from flask_jwt_extended import (
8
+ jwt_required,
9
+ get_jwt_identity,
10
+ )
11
+
12
+ from dservercore import UnknownURIError
13
+ from dservercore.blueprint import Blueprint
14
+ from dservercore.schemas import ManifestSchema
15
+ import dservercore.utils_auth
16
+ from dservercore.utils import (
17
+ url_suffix_to_uri,
18
+ get_manifest_from_uri_by_user
19
+ )
20
+
21
+ bp = Blueprint("manifests", __name__, url_prefix="/manifests")
22
+
23
+ @bp.route("/<path:uri>", methods=["GET"])
24
+ @bp.response(200, ManifestSchema)
25
+ @bp.alt_response(1, description=2)
26
+ @bp.alt_response(403, description="No permissions")
27
+ @bp.alt_response(404, description="Not found")
28
+ @jwt_required()
29
+ def manifest(uri):
30
+ """Request the dataset manifest."""
31
+ username = get_jwt_identity()
32
+ if not dservercore.utils_auth.user_exists(username):
33
+ # Unregistered users should see 401.
34
+ abort(401)
35
+
36
+ uri = url_suffix_to_uri(uri)
37
+ if not dservercore.utils_auth.may_access(username, uri):
38
+ # Authorization errors should return 400.
39
+ abort(403)
40
+
41
+ try:
42
+ manifest_ = get_manifest_from_uri_by_user(username, uri)
43
+ except UnknownURIError:
44
+ current_app.logger.info("UnknownURIError")
45
+ abort(404)
46
+
47
+ return jsonify(manifest_)
48
+
49
+
@@ -0,0 +1,50 @@
1
+ """Routes for me (information on currently authenticated user)"""
2
+ from flask import (
3
+ abort,
4
+ jsonify,
5
+ )
6
+ from flask_jwt_extended import (
7
+ jwt_required,
8
+ get_jwt_identity,
9
+ )
10
+
11
+ import dservercore.utils
12
+ import dservercore.utils_auth
13
+
14
+ from dservercore.blueprint import Blueprint
15
+ from dservercore.sql_models import UserSchema, UserWithPermissionsSchema
16
+ from dservercore.schemas import SummarySchema
17
+ from dservercore.utils import summary_of_datasets_by_user
18
+
19
+
20
+ bp = Blueprint("me", __name__, url_prefix="/me")
21
+
22
+
23
+ @bp.route("", methods=["GET"])
24
+ @bp.response(200, UserWithPermissionsSchema)
25
+ @bp.alt_response(401, description="Not registered")
26
+ @jwt_required()
27
+ def me_get():
28
+ """Return information on me (the user currently authenticated)."""
29
+ identity = get_jwt_identity()
30
+
31
+ if not dservercore.utils_auth.user_exists(identity):
32
+ abort(401)
33
+
34
+ return dservercore.utils.get_user_info(identity)
35
+
36
+
37
+ @bp.route("/summary", methods=["GET"])
38
+ @bp.response(200, SummarySchema)
39
+ @bp.alt_response(401, description="Not registered")
40
+ @jwt_required()
41
+ def me_summary_get():
42
+ """Global summary of the datasets the currently authenticated user has access to."""
43
+ identity = get_jwt_identity()
44
+
45
+ if not dservercore.utils_auth.user_exists(identity):
46
+ # Authenticated user does not exist
47
+ abort(401)
48
+
49
+ summary = summary_of_datasets_by_user(identity)
50
+ return summary
@@ -0,0 +1,48 @@
1
+ """Route for retrieving the readme of a dataset"""
2
+ from flask import (
3
+ abort,
4
+ jsonify,
5
+ current_app
6
+ )
7
+ from flask_jwt_extended import (
8
+ jwt_required,
9
+ get_jwt_identity,
10
+ )
11
+
12
+ from dservercore import UnknownURIError
13
+ from dservercore.blueprint import Blueprint
14
+ from dservercore.schemas import ReadmeSchema
15
+ import dservercore.utils_auth
16
+ from dservercore.utils import (
17
+ url_suffix_to_uri,
18
+ get_readme_from_uri_by_user
19
+ )
20
+
21
+ bp = Blueprint("readmes", __name__, url_prefix="/readmes")
22
+
23
+
24
+ @bp.route("/<path:uri>", methods=["GET"])
25
+ @bp.response(200, ReadmeSchema)
26
+ @bp.alt_response(401, description="Not registered")
27
+ @bp.alt_response(403, description="No permissions")
28
+ @bp.alt_response(404, description="Not found")
29
+ @jwt_required()
30
+ def readme(uri):
31
+ """Request the dataset readme."""
32
+ username = get_jwt_identity()
33
+ if not dservercore.utils_auth.user_exists(username):
34
+ # Unregistered users should see 401.
35
+ abort(401)
36
+
37
+ uri = url_suffix_to_uri(uri)
38
+ if not dservercore.utils_auth.may_access(username, uri):
39
+ # Authorization errors should return 400.
40
+ abort(403)
41
+
42
+ try:
43
+ readme = get_readme_from_uri_by_user(username, uri)
44
+ except UnknownURIError:
45
+ current_app.logger.info("UnknownURIError")
46
+ abort(404)
47
+
48
+ return {"readme": readme}
dservercore/schemas.py ADDED
@@ -0,0 +1,83 @@
1
+ """marshmallow schema for (de-) serialization and validation"""
2
+ from marshmallow import Schema
3
+ from marshmallow.fields import (
4
+ String,
5
+ UUID,
6
+ Dict,
7
+ List,
8
+ Boolean,
9
+ Integer,
10
+ Nested,
11
+ Float,
12
+ Raw
13
+ )
14
+
15
+
16
+ class ConfigSchema(Schema):
17
+ config = Dict(keys=String(), values=Raw())
18
+
19
+
20
+ class VersionSchema(Schema):
21
+ versions = Dict(keys=String(), values=String())
22
+
23
+
24
+ class ItemSchema(Schema):
25
+ hash = String()
26
+ relpath = String()
27
+ size_in_bytes = Integer()
28
+ utc_timestamp = Float()
29
+
30
+
31
+ class ReadmeSchema(Schema):
32
+ readme = String()
33
+
34
+
35
+ class ManifestSchema(Schema):
36
+ items = Dict(keys=String, values=Nested(ItemSchema))
37
+ hash_function = String()
38
+ dtoolcore_version = String()
39
+
40
+
41
+ # Define a schema for the response
42
+ class AnnotationSchema(Schema):
43
+ annotations = Dict(keys=String(), values=String())
44
+
45
+
46
+ class TagSchema(Schema):
47
+ tags = List(String())
48
+
49
+
50
+ class RegisterDatasetSchema(Schema):
51
+ uuid = UUID()
52
+ base_uri = String()
53
+ uri = String()
54
+ # dtoolcore_version should be included when storing (based on current version) but not required on the request
55
+ name = String()
56
+ type = String()
57
+ readme = String()
58
+ manifest = Nested(ManifestSchema)
59
+ creator_username = String()
60
+ frozen_at = String()
61
+ created_at = String()
62
+ annotations = Dict()
63
+ tags = List(String)
64
+ number_of_items = Integer()
65
+ size_in_bytes = Integer()
66
+
67
+
68
+ class SearchDatasetSchema(Schema):
69
+ free_text = String()
70
+ creator_usernames = List(String)
71
+ base_uris = List(String)
72
+ uuids = List(UUID)
73
+ tags = List(String)
74
+
75
+
76
+ class SummarySchema(Schema):
77
+ number_of_datasets = Integer()
78
+ creator_usernames = List(String)
79
+ base_uris = List(String)
80
+ datasets_per_creator = Dict(keys=String, values=Integer)
81
+ datasets_per_base_uri = Dict(keys=String, values=Integer)
82
+ tags = List(String)
83
+ datasets_per_tag = Dict(keys=String, values=Integer)