mirror of
https://github.com/enpaul/keyosk.git
synced 2024-11-24 23:47:49 +00:00
Add resources submodules and basic infrastructure
This commit is contained in:
parent
90ea657ee9
commit
8e7f3301d1
28
keyosk/resources/__init__.py
Normal file
28
keyosk/resources/__init__.py
Normal file
@ -0,0 +1,28 @@
|
||||
from typing import List
|
||||
from typing import Type
|
||||
|
||||
from keyosk.resources._shared import KeyoskResource
|
||||
from keyosk.resources.account import AccountMultiResource
|
||||
from keyosk.resources.account import AccountPermissionResource
|
||||
from keyosk.resources.account import AccountSingleResource
|
||||
from keyosk.resources.auth import AuthenticationResource
|
||||
from keyosk.resources.blacklist import BlacklistResource
|
||||
from keyosk.resources.domain import DomainAuditResource
|
||||
from keyosk.resources.domain import DomainMultiResource
|
||||
from keyosk.resources.domain import DomainSingleResource
|
||||
from keyosk.resources.openapi import OpenAPIResource
|
||||
from keyosk.resources.public_key import PublicKeyResource
|
||||
|
||||
|
||||
RESOURCES: List[Type[KeyoskResource]] = [
|
||||
AuthenticationResource,
|
||||
OpenAPIResource,
|
||||
PublicKeyResource,
|
||||
BlacklistResource,
|
||||
DomainMultiResource,
|
||||
DomainSingleResource,
|
||||
DomainAuditResource,
|
||||
AccountMultiResource,
|
||||
AccountSingleResource,
|
||||
AccountPermissionResource,
|
||||
]
|
47
keyosk/resources/account.py
Normal file
47
keyosk/resources/account.py
Normal file
@ -0,0 +1,47 @@
|
||||
from keyosk.resources._shared import KeyoskResource
|
||||
from keyosk.resources._shared import ResponseTuple
|
||||
|
||||
|
||||
class AccountMultiResource(KeyoskResource):
|
||||
|
||||
ROUTES = ("/account/",)
|
||||
|
||||
def get(self) -> ResponseTuple:
|
||||
raise NotImplementedError
|
||||
|
||||
def post(self) -> ResponseTuple:
|
||||
raise NotImplementedError
|
||||
|
||||
def head(self) -> ResponseTuple:
|
||||
return self._head(self.get())
|
||||
|
||||
|
||||
class AccountSingleResource(KeyoskResource):
|
||||
|
||||
ROUTES = "/account/<string:account_ref>/"
|
||||
|
||||
def get(self, account_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def patch(self, account_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def delete(self, account_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def head(self, account_ref: str) -> ResponseTuple:
|
||||
return self._head(self.get(account_ref))
|
||||
|
||||
|
||||
class AccountPermissionResource(KeyoskResource):
|
||||
|
||||
ROUTES = "/account/<string:account_ref>/permission"
|
||||
|
||||
def get(self, account_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def patch(self, account_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def head(self, account_ref: str) -> ResponseTuple:
|
||||
return self._head(self.get(account_ref))
|
13
keyosk/resources/auth.py
Normal file
13
keyosk/resources/auth.py
Normal file
@ -0,0 +1,13 @@
|
||||
from keyosk.resources._shared import KeyoskResource
|
||||
from keyosk.resources._shared import ResponseTuple
|
||||
|
||||
|
||||
class AuthenticationResource(KeyoskResource):
|
||||
|
||||
ROUTES = "/auth/<string:domain_ref>"
|
||||
|
||||
def get(self, domain_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def head(self, domain_ref: str) -> ResponseTuple:
|
||||
raise NotImplementedError
|
16
keyosk/resources/blacklist.py
Normal file
16
keyosk/resources/blacklist.py
Normal file
@ -0,0 +1,16 @@
|
||||
from keyosk.resources._shared import KeyoskResource
|
||||
from keyosk.resources._shared import ResponseTuple
|
||||
|
||||
|
||||
class BlacklistResource(KeyoskResource):
|
||||
|
||||
ROUTES = ("/blacklist/",)
|
||||
|
||||
def get(self) -> ResponseTuple:
|
||||
raise NotImplementedError
|
||||
|
||||
def post(self) -> ResponseTuple:
|
||||
raise NotImplementedError
|
||||
|
||||
def head(self) -> ResponseTuple:
|
||||
return self._head(self.get())
|
44
keyosk/resources/domain.py
Normal file
44
keyosk/resources/domain.py
Normal file
@ -0,0 +1,44 @@
|
||||
from keyosk.resources._shared import KeyoskResource
|
||||
from keyosk.resources._shared import ResponseTuple
|
||||
|
||||
|
||||
class DomainMultiResource(KeyoskResource):
|
||||
|
||||
ROUTES = ("/domain/",)
|
||||
|
||||
def get(self) -> ResponseTuple:
|
||||
raise NotImplementedError
|
||||
|
||||
def post(self) -> ResponseTuple:
|
||||
raise NotImplementedError
|
||||
|
||||
def head(self) -> ResponseTuple:
|
||||
return self._head(self.get())
|
||||
|
||||
|
||||
class DomainSingleResource(KeyoskResource):
|
||||
|
||||
ROUTES = "/domain/<string:domain_ref>/"
|
||||
|
||||
def get(self, domain_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def patch(self, domain_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def delete(self, domain_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def head(self, domain_ref: str) -> ResponseTuple:
|
||||
return self._head(self.get(domain_ref))
|
||||
|
||||
|
||||
class DomainAuditResource(KeyoskResource):
|
||||
|
||||
ROUTES = "/domain/<string:domain_ref>/audit"
|
||||
|
||||
def get(self, domain_ref: str) -> ResponseTuple:
|
||||
raise NotADirectoryError
|
||||
|
||||
def head(self, domain_ref: str) -> ResponseTuple:
|
||||
return self._head(self.get(domain_ref))
|
13
keyosk/resources/openapi.py
Normal file
13
keyosk/resources/openapi.py
Normal file
@ -0,0 +1,13 @@
|
||||
from keyosk.resources._shared import KeyoskResource
|
||||
from keyosk.resources._shared import ResponseTuple
|
||||
|
||||
|
||||
class OpenAPIResource(KeyoskResource):
|
||||
|
||||
ROUTES = ("/openapi.json",)
|
||||
|
||||
def get(self) -> ResponseTuple:
|
||||
raise NotImplementedError
|
||||
|
||||
def head(self) -> ResponseTuple:
|
||||
return self._head(self.get())
|
13
keyosk/resources/public_key.py
Normal file
13
keyosk/resources/public_key.py
Normal file
@ -0,0 +1,13 @@
|
||||
from keyosk.resources._shared import KeyoskResource
|
||||
from keyosk.resources._shared import ResponseTuple
|
||||
|
||||
|
||||
class PublicKeyResource(KeyoskResource):
|
||||
|
||||
ROUTES = ("/public-key",)
|
||||
|
||||
def get(self) -> ResponseTuple:
|
||||
raise NotImplementedError
|
||||
|
||||
def head(self) -> ResponseTuple:
|
||||
return self._head(self.get())
|
Loading…
Reference in New Issue
Block a user