xia_flask_api.rest.RestApi
- class xia_flask_api.rest.RestApi
Bases:
object
Standard Mapping between method and http end point: Resource Level Actions
list = /owner/<owner_name>/<type> GET
- Root Level Actions
load = /owner/<owner_name>/<type>/<name> GET
new = /owner/<owner_name>/<type>/<name> POST
remove = /owner/<owner_name>/<type>/<name> DELETE
update = /owner/<owner_name>/<type>/<name> PATCH
In this case, endpoint is <type>.root
- Resource Log Level Actions
log = /owner/<owner_name>/<type>/<name>/log GET
- Handler Level Actions
attach = /owner/<owner_name>/<type>/<name>/handler POST
migrate = /owner/<owner_name>/<type>/<name>/handler PUT
detach = /owner/<owner_name>/<type>/<name>/handler DELETE
In this case, endpoint is <type>.handler
- Action handled by Action (task is a special action which could only be run once at a time)
action = /owner/<owner_name>/<type>/<name>/handler/<method> POST
- task = /owner/<owner_name>/<type>/<name>/handler/<method> POST
one resource could only have one task at the same time
unlock = /owner/<owner_name>/<type>/<name>/handler/<method> DELETE
- __init__()
Methods
__init__
()action_restapi
(owner_name, name, method, ...)collection_restapi
(owner_name, meta_class)get_act_from_request
(endpoint_type, values)get_authorization
(endpoint, values)Default wrap of @app.url_value_preprocessor to get values
get_response
(response)- param response
response returned by program
handler_restapi
(owner_name, name, worker_class)Root related method Mapping described at the beginning
root_restapi
(owner_name, name, meta_class)Root related method Mapping described at the beginning
Attributes
DOMAIN_BASED
PATH_BASED
Dictionary of authenticator
site_type
- apikey_cache
Hold API Key Caches
alias of
object
- authenticators = {'default': <class 'object'>}
Dictionary of authenticator
- classmethod get_authorization(endpoint, values)
Default wrap of @app.url_value_preprocessor to get values
- Case API Key:
Check user logon
Generated the enforcer
- classmethod get_response(response)
- Parameters
response – response returned by program
- Returns
HTTP Response at Flask Type
- classmethod handler_restapi(owner_name: str, name: str, worker_class)
Root related method Mapping described at the beginning
- Parameters
owner_name – worker owner
name – worker name
worker_class – the class of the worker
- Returns
HTTP Response
- mail_sender
Engine for sending mail
alias of
MailSender
- perm_cache
Hold Permission Caches
alias of
object
- permission_manager
Hold Permissions
alias of
object
- classmethod root_restapi(owner_name: str, name: str, meta_class)
Root related method Mapping described at the beginning
- Parameters
owner_name – worker owner
name – worker name
meta_class – the class of the worker or provisioner
- Returns
HTTP Response
- task_manager
Task manager
alias of
Task
- token_manager
Token manager
alias of
Token
- user_manager
Hold Users
alias of
object