quetzal.app.api package¶
Subpackages¶
Submodules¶
quetzal.app.api.auth module¶
-
quetzal.app.api.auth.
check_apikey
(key, required_scopes=None)¶
-
quetzal.app.api.auth.
check_basic
(username, password, required_scopes=None)¶
-
quetzal.app.api.auth.
check_bearer
(token)¶
-
quetzal.app.api.auth.
get_token
(*, user)¶
-
quetzal.app.api.auth.
logout
(*, user)¶
quetzal.app.api.exceptions module¶
-
exception
quetzal.app.api.exceptions.
APIException
(status=400, title=None, detail=None, type=None, instance=None, headers=None, ext=None)¶ Bases:
connexion.exceptions.ProblemException
Exception for API-related problems
Use this class when a route function fails but the API should respond with an appropriate error response
-
exception
quetzal.app.api.exceptions.
Conflict
¶
-
exception
quetzal.app.api.exceptions.
EmptyCommit
¶
-
exception
quetzal.app.api.exceptions.
InvalidTransitionException
¶
-
exception
quetzal.app.api.exceptions.
ObjectNotFoundException
(status=400, title=None, detail=None, type=None, instance=None, headers=None, ext=None)¶ Bases:
quetzal.app.api.exceptions.APIException
Exception for cases when an object does not exist
Typically, when a workspace or file does not exist
-
exception
quetzal.app.api.exceptions.
QuetzalException
¶ Bases:
Exception
Represents an internal error in the data API
Use for exceptions that don’t need to be transmitted back as a response
-
exception
quetzal.app.api.exceptions.
WorkerException
¶
quetzal.app.api.router module¶
Router controller to let Connexion link OAS operation ids to custom functions.
On a OpenAPI specification, operationIds can be as specific as:
app.api.data.workspace.create
. However, other clients may use this long
name, which generates functions with long names. Moreover, the real use-case of
operationId is to provide a unique identifier to each operation.
To simplify the client code, we use Connexion’s vendor-specific tag
x-openapi-router-controller
to provide a class to associate operations to
Python functions. Following Connexion’s implementation, the resolved name is
controller.operationId
where controller
is the value of the
x-openapi-router-controller
tag.
This Python function provides the functions and associations to use the
x-openapi-router-controller
tag and simplify the specification code.
-
class
quetzal.app.api.router.
AuthRouter
¶ Bases:
object
Router for authentication operations.
Use as:
operationId: auth.func x-openapi-router-controller: app.api.router
Where
func
is a member of this class.-
get_token
()¶
-
logout
()¶
-
-
class
quetzal.app.api.router.
PublicRouter
¶ Bases:
object
Router for operations on public resources.
Use as:
operationId: public.func x-openapi-router-controller: app.api.router
Where
func
is a member of this class.-
file_details
()¶ Get the contents or metadata of a file that has been committed
-
file_fetch
(**kwargs)¶ Get all the files that have been committed.
-
query_create
(*, user, token_info=None)¶
-
query_details
(*, user, token_info=None)¶
-
query_fetch
(*, token_info=None)¶
-
-
class
quetzal.app.api.router.
WorkspaceFilesRouter
¶ Bases:
object
Router for operations on files inside a workspace.
Use as:
operationId: workspace_file.func x-openapi-router-controller: app.api.router
Where
func
is a member of this class.-
create
(*, content=None, user, token_info=None)¶ Create a file on a workspace
This function is the implementation of the upload file endpoint in the Quetzal API. After verifying the workspace and user permissions, it will save the contents of the file in the configured file backend. Finally, it initializes the base metadata family entries for the new file.
- Parameters
wid (int) – Workspace identifier where the file will be uploaded.
content (file-like) – Contents of the file.
user (quetzal.app.models.User) – User that owns the file. This parameter is set by connexion.
token_info – Authentication token. This parameter is set by connexion.
- Returns
details (dict) – File details object.
code (int) – HTTP response code.
API endpoints
POST /api/v1/data/workspaces/{wid}/files/ See in redoc.
-
delete
(*, uuid, user, token_info=None)¶
-
details
(*, uuid)¶ Get contents or metadata of a file on a workspace
-
fetch
()¶ Get all the files on a workspace
-
set_metadata
(*, uuid, body)¶
-
update_metadata
(*, uuid, body)¶
-
-
class
quetzal.app.api.router.
WorkspaceQueryRouter
¶ Bases:
object
Router for operations on queries inside a workspace.
Use as:
operationId: workspace_query.func x-openapi-router-controller: app.api.router
Where
func
is a member of this class.-
create
(*, body, user, token_info=None)¶
-
details
(*, qid, user, token_info=None)¶
-
fetch
(*, user, token_info=None)¶
-
-
class
quetzal.app.api.router.
WorkspaceRouter
¶ Bases:
object
Router for workspace operations.
Use as:
operationId: workspace.func x-openapi-router-controller: app.api.router
Where
func
is a member of this class.-
commit
()¶ Request commit of all metadata and files of a workspace
- Parameters
wid (int) – Workspace identifier
- Returns
dict – Workspace details
int – HTTP response code
-
create
(*, user, token_info=None)¶ Create a new workspace
- Returns
dict – Workspace details
int – HTTP response code
-
delete
(*, wid)¶ Request deletion of a workspace by id
- Parameters
wid (int) – Workspace identifier
- Returns
dict – Workspace details
int – HTTP response code
-
details
()¶ Get workspace details by id
- Parameters
wid (int) – Workspace identifier
- Returns
dict – Workspace details
int – HTTP response code
-
fetch
()¶ List workspaces
- Returns
list – List of Workspace details as a dictionaries
int – HTTP response code
-
-
quetzal.app.api.router.
auth
¶ alias of
quetzal.app.api.router.AuthRouter
-
quetzal.app.api.router.
public
¶ alias of
quetzal.app.api.router.PublicRouter
-
quetzal.app.api.router.
workspace
¶
-
quetzal.app.api.router.
workspace_file
¶
-
quetzal.app.api.router.
workspace_query
¶