Skip to content

Commit cc85b6d

Browse files
committed
quilt3.admin: add tabulator tables API
1 parent e05f3d9 commit cc85b6d

File tree

11 files changed

+268
-3
lines changed

11 files changed

+268
-3
lines changed

api/python/quilt3-admin/queries.graphql

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,33 @@ mutation ssoConfigSet($config: String) {
212212
}
213213
}
214214
}
215+
216+
query bucketTabulatorTablesList($name: String!) {
217+
bucketConfig(name: $name) {
218+
tabulatorTables {
219+
name
220+
config
221+
}
222+
}
223+
}
224+
225+
mutation bucketTabulatorTableSet($bucketName: String!, $tableName: String!, $config: String) {
226+
admin {
227+
bucketSetTabulatorTable(bucketName: $bucketName, tableName: $tableName, config: $config) {
228+
__typename
229+
... on InvalidInput {
230+
errors {
231+
context
232+
message
233+
name
234+
path
235+
}
236+
}
237+
... on OperationError {
238+
message
239+
name
240+
context
241+
}
242+
}
243+
}
244+
}

api/python/quilt3/admin/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
APIs for Quilt administrators. 'Registry' refers to Quilt stack backend services, including identity management.
33
"""
44

5-
# This wraps code generated by aridne-codegen to provide a more user-friendly API.
5+
# This wraps code generated by ariadne-codegen to provide a more user-friendly API.
66

7-
from . import roles, sso_config, users
8-
from .exceptions import Quilt3AdminError, UserNotFoundError
7+
from . import roles, sso_config, tabulator, users
8+
from .exceptions import BucketNotFoundError, Quilt3AdminError, UserNotFoundError
99
from .types import ManagedRole, SSOConfig, UnmanagedRole, User

api/python/quilt3/admin/_graphql_client/__init__.py

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/python/quilt3/admin/_graphql_client/bucket_tabulator_table_set.py

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/python/quilt3/admin/_graphql_client/bucket_tabulator_tables_list.py

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/python/quilt3/admin/_graphql_client/client.py

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/python/quilt3/admin/exceptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ def __init__(self, details):
77
class UserNotFoundError(Quilt3AdminError):
88
def __init__(self):
99
super().__init__(None)
10+
11+
12+
class BucketNotFoundError(Quilt3AdminError):
13+
def __init__(self):
14+
super().__init__(None)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import typing as T
2+
3+
from . import exceptions, types, util
4+
5+
6+
def list(bucket_name: str) -> list[types.TabulatorTable]:
7+
"""
8+
List all tabulator tables in a bucket.
9+
"""
10+
result = util.get_client().bucket_tabulator_tables_list(bucket_name)
11+
if result is None:
12+
raise exceptions.BucketNotFoundError
13+
return [types.TabulatorTable(**x.model_dump()) for x in result.tabulator_tables]
14+
15+
16+
def set(bucket_name: str, table_name: str, config: T.Optional[str]) -> types.TabulatorTable:
17+
"""
18+
Set the tabulator table configuration. Pass `None` to remove the table.
19+
"""
20+
result = util.get_client().bucket_tabulator_table_set(bucket_name, table_name, config)
21+
return types.TabulatorTable(**util.handle_errors(result).model_dump())

api/python/quilt3/admin/types.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ class SSOConfig:
4444
text: str
4545
timestamp: datetime
4646
uploader: User
47+
48+
49+
@pydantic.dataclasses.dataclass
50+
class TabulatorTable:
51+
name: str
52+
config: str

docs/api-reference/Admin.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
## SSOConfig(text: str, timestamp: datetime.datetime, uploader: quilt3.admin.types.User) -> None {#SSOConfig}
1515

1616

17+
## TabulatorTable(name: str, config: str) -> None {#TabulatorTable}
18+
19+
1720
# quilt3.admin.roles
1821

1922

0 commit comments

Comments
 (0)