mrok 0.1.9__py3-none-any.whl → 0.2.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.
- mrok/controller/app.py +3 -1
- mrok/controller/routes/__init__.py +0 -0
- mrok/controller/routes/instances.py +71 -0
- {mrok-0.1.9.dist-info → mrok-0.2.0.dist-info}/METADATA +1 -1
- {mrok-0.1.9.dist-info → mrok-0.2.0.dist-info}/RECORD +9 -7
- /mrok/controller/{routes.py → routes/extensions.py} +0 -0
- {mrok-0.1.9.dist-info → mrok-0.2.0.dist-info}/WHEEL +0 -0
- {mrok-0.1.9.dist-info → mrok-0.2.0.dist-info}/entry_points.txt +0 -0
- {mrok-0.1.9.dist-info → mrok-0.2.0.dist-info}/licenses/LICENSE.txt +0 -0
mrok/controller/app.py
CHANGED
|
@@ -8,7 +8,8 @@ from fastapi.routing import APIRoute, APIRouter
|
|
|
8
8
|
from mrok.conf import get_settings
|
|
9
9
|
from mrok.controller.auth import authenticate
|
|
10
10
|
from mrok.controller.openapi import generate_openapi_spec
|
|
11
|
-
from mrok.controller.routes import router as extensions_router
|
|
11
|
+
from mrok.controller.routes.extensions import router as extensions_router
|
|
12
|
+
from mrok.controller.routes.instances import router as instances_router
|
|
12
13
|
|
|
13
14
|
logger = logging.getLogger(__name__)
|
|
14
15
|
|
|
@@ -52,6 +53,7 @@ def setup_app():
|
|
|
52
53
|
app.include_router(
|
|
53
54
|
extensions_router, prefix="/extensions", dependencies=[Depends(authenticate)]
|
|
54
55
|
)
|
|
56
|
+
app.include_router(instances_router, prefix="/instances", dependencies=[Depends(authenticate)])
|
|
55
57
|
|
|
56
58
|
settings = get_settings()
|
|
57
59
|
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from fastapi import APIRouter, HTTPException, status
|
|
4
|
+
|
|
5
|
+
from mrok.controller.dependencies import ZitiManagementAPI
|
|
6
|
+
from mrok.controller.openapi import examples
|
|
7
|
+
from mrok.controller.pagination import LimitOffsetPage, paginate
|
|
8
|
+
from mrok.controller.schemas import InstanceRead
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger("mrok.controller")
|
|
11
|
+
|
|
12
|
+
router = APIRouter()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async def fetch_instance_or_404(mgmt_api: ZitiManagementAPI, id_or_instance_id: str):
|
|
16
|
+
identity = await mgmt_api.search_identity(id_or_instance_id)
|
|
17
|
+
if not identity:
|
|
18
|
+
raise HTTPException(
|
|
19
|
+
status_code=status.HTTP_404_NOT_FOUND,
|
|
20
|
+
)
|
|
21
|
+
return identity
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@router.get(
|
|
25
|
+
"/{id_or_instance_id}",
|
|
26
|
+
response_model=InstanceRead,
|
|
27
|
+
responses={
|
|
28
|
+
200: {
|
|
29
|
+
"description": "Instance",
|
|
30
|
+
"content": {"application/json": {"example": examples.INSTANCE_RESPONSE}},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
dependencies=[],
|
|
34
|
+
tags=["Instances"],
|
|
35
|
+
)
|
|
36
|
+
async def get_instance_by_id_or_instance_id(
|
|
37
|
+
mgmt_api: ZitiManagementAPI,
|
|
38
|
+
id_or_instance_id: str,
|
|
39
|
+
):
|
|
40
|
+
identity = await fetch_instance_or_404(mgmt_api, id_or_instance_id)
|
|
41
|
+
return InstanceRead(**identity)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@router.get(
|
|
45
|
+
"",
|
|
46
|
+
response_model=LimitOffsetPage[InstanceRead],
|
|
47
|
+
responses={
|
|
48
|
+
200: {
|
|
49
|
+
"description": "List of Instances",
|
|
50
|
+
"content": {
|
|
51
|
+
"application/json": {
|
|
52
|
+
"example": {
|
|
53
|
+
"data": [examples.INSTANCE_RESPONSE],
|
|
54
|
+
"$meta": {
|
|
55
|
+
"pagination": {
|
|
56
|
+
"total": 1,
|
|
57
|
+
"limit": 10,
|
|
58
|
+
"offset": 0,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
tags=["Instances"],
|
|
67
|
+
)
|
|
68
|
+
async def get_instances(
|
|
69
|
+
mgmt_api: ZitiManagementAPI,
|
|
70
|
+
):
|
|
71
|
+
return await paginate(mgmt_api, "/identities", InstanceRead)
|
|
@@ -31,10 +31,9 @@ mrok/cli/commands/controller/__init__.py,sha256=2xw-YVN0akiLiuGUU3XbYyZZ0ugOjQ6X
|
|
|
31
31
|
mrok/cli/commands/controller/openapi.py,sha256=QLjVao9UkB2vBaGkFi_q_jrlg4Np4ldMRwDIJsrJ7A8,1175
|
|
32
32
|
mrok/cli/commands/controller/run.py,sha256=osyjssb81xNMYZLPb6dfPR4W_BQlCxKDfvl-BIhG_1A,2460
|
|
33
33
|
mrok/controller/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
mrok/controller/app.py,sha256
|
|
34
|
+
mrok/controller/app.py,sha256=_MzTu_wFRbD4kGbw4PdP5OYpl3KDlOCJFeNWxt-WM-c,1818
|
|
35
35
|
mrok/controller/auth.py,sha256=Kg94W8yNMs6TvUmLRYv1QeUjDy4qlGZ-_6OHa4KH1zg,2648
|
|
36
36
|
mrok/controller/pagination.py,sha256=raYpYa34q8Ckl4BXBOEdpWlKkFj6z7e6QLWr2HT7dzI,2187
|
|
37
|
-
mrok/controller/routes.py,sha256=j-dLO4yLkUj-rdjnGhO2suvmR690-UdaNvokDZ7ZpF0,8670
|
|
38
37
|
mrok/controller/schemas.py,sha256=zk91PIJ0zncpBgs4bhU-n-76EWlRKo87r3VVx15JxPc,1320
|
|
39
38
|
mrok/controller/dependencies/__init__.py,sha256=voewk6gjkA0OarL6HFmfT_RLqBns0Fpl-VIqK5xVAEI,202
|
|
40
39
|
mrok/controller/dependencies/conf.py,sha256=2Pa8fxJHkZ29q6UL-w6hUP_wr7WnNELfw5LlzWg1Tec,162
|
|
@@ -42,6 +41,9 @@ mrok/controller/dependencies/ziti.py,sha256=fYoxeJb4s6p2_3gxbExbFSRabjpvp_gZMBb3
|
|
|
42
41
|
mrok/controller/openapi/__init__.py,sha256=U1dw45w76CcoQagyqg_FXdMuJF3qJZZM6wG8TeTe3Zo,101
|
|
43
42
|
mrok/controller/openapi/examples.py,sha256=ZI0BP7L6sI0z7Mq1I3uc2UrweGpzpPeGSIuf1bUKkgg,1419
|
|
44
43
|
mrok/controller/openapi/utils.py,sha256=Kn55ISAWlMJNwrJTum7iFrBvJvr81To76pCK8W-s79Q,1114
|
|
44
|
+
mrok/controller/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
|
+
mrok/controller/routes/extensions.py,sha256=j-dLO4yLkUj-rdjnGhO2suvmR690-UdaNvokDZ7ZpF0,8670
|
|
46
|
+
mrok/controller/routes/instances.py,sha256=rcpbKfLsYsokOo7aZamzQks-c9AYoU-8KKK9pDYpoOY,1963
|
|
45
47
|
mrok/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
48
|
mrok/http/config.py,sha256=k8mjvD3ninJn-v1t-co-GSa3upm4b70bWyk3fwdcOh8,2161
|
|
47
49
|
mrok/http/forwarder.py,sha256=mo-Z8B8Zg6kdDX-lWEiptRv-9kJU9cEdmg6gt6eF0cc,11374
|
|
@@ -57,8 +59,8 @@ mrok/ziti/errors.py,sha256=yYCbVDwktnR0AYduqtynIjo73K3HOhIrwA_vQimvEd4,368
|
|
|
57
59
|
mrok/ziti/identities.py,sha256=oE_3j6Y4xCr6uKNdprW55bxGsyKnmJt-MrxrylB2Ey4,5388
|
|
58
60
|
mrok/ziti/pki.py,sha256=-V3LDAtntYZ4C6IH2rqfAANxmzpOZ32Rd0MK_27YNME,1906
|
|
59
61
|
mrok/ziti/services.py,sha256=JnznLTHNZjgbFwnBtv7y2XIp4NiQxLVawwP9EfWdVuM,3208
|
|
60
|
-
mrok-0.
|
|
61
|
-
mrok-0.
|
|
62
|
-
mrok-0.
|
|
63
|
-
mrok-0.
|
|
64
|
-
mrok-0.
|
|
62
|
+
mrok-0.2.0.dist-info/METADATA,sha256=A2vtrbNcUnIOTYf0xU2KZubFzN_yA7wShKQuMZcnKaE,15506
|
|
63
|
+
mrok-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
64
|
+
mrok-0.2.0.dist-info/entry_points.txt,sha256=tloXwvU1uJicBJR2h-8HoVclPgwJWDwuREMHN8Zq-nU,38
|
|
65
|
+
mrok-0.2.0.dist-info/licenses/LICENSE.txt,sha256=6PaICaoA3yNsZKLv5G6OKqSfLSoX7MakYqTDgJoTCBs,11346
|
|
66
|
+
mrok-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|