laniakea-api-server 0.2.4__tar.gz → 0.2.6__tar.gz
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.
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/PKG-INFO +1 -1
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/config.py +3 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/queue.py +36 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/routers/agent.py +6 -2
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/routers/credentials.py +22 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/pyproject.toml +1 -1
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/.github/workflows/publish.yml +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/.gitignore +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/LICENSE +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/README.md +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/__init__.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/auth.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/cli.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/credential_parser.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/database.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/installer.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/main.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/models.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/routers/.health.py.swp +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/routers/__init__.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/routers/agents.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/routers/deployments.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/routers/health.py +0 -0
- {laniakea_api_server-0.2.4 → laniakea_api_server-0.2.6}/laniakea_api/routers/tfstate.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: laniakea-api-server
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: Laniakea Queue API — OIDC-authenticated gateway for cloud deployment orchestration
|
|
5
5
|
Project-URL: Homepage, https://github.com/laniakea/laniakea-api
|
|
6
6
|
Project-URL: Issues, https://github.com/laniakea/laniakea-api/issues
|
|
@@ -113,3 +113,39 @@ def check_vault() -> str:
|
|
|
113
113
|
except Exception as exc:
|
|
114
114
|
return f"error: {exc}"
|
|
115
115
|
|
|
116
|
+
#per-cloud credentials: secret/<sub>/service_creds/<name>
|
|
117
|
+
|
|
118
|
+
def _sc_path(user_sub: str, name: str = "") -> str:
|
|
119
|
+
base = f"{user_sub}/service_creds"
|
|
120
|
+
return f"{base}/{name}" if name else base
|
|
121
|
+
|
|
122
|
+
def vault_list_service_creds(user_sub: str) -> list:
|
|
123
|
+
client = get_vault_client()
|
|
124
|
+
try:
|
|
125
|
+
resp = client.secrets.kv.v2.list_secrets(path=_sc_path(user_sub), mount_point=VAULT_MOUNT)
|
|
126
|
+
names = [k.rstrip("/") for k in resp["data"]["keys"]]
|
|
127
|
+
except Exception:
|
|
128
|
+
return []
|
|
129
|
+
out = []
|
|
130
|
+
for n in names:
|
|
131
|
+
data = vault_read_service_creds(user_sub, n)
|
|
132
|
+
out.append({"name": n, "service_type": data.get("service_type", "openstack")})
|
|
133
|
+
return out
|
|
134
|
+
|
|
135
|
+
def vault_read_service_creds(user_sub: str, name: str) -> dict:
|
|
136
|
+
client = get_vault_client()
|
|
137
|
+
try:
|
|
138
|
+
resp = client.secrets.kv.v2.read_secret_version(path=_sc_path(user_sub, name), mount_point=VAULT_MOUNT)
|
|
139
|
+
return resp["data"]["data"] or {}
|
|
140
|
+
except Exception:
|
|
141
|
+
return {}
|
|
142
|
+
|
|
143
|
+
def vault_write_service_creds(user_sub: str, name: str, data: dict) -> None:
|
|
144
|
+
client = get_vault_client()
|
|
145
|
+
client.secrets.kv.v2.create_or_update_secret(
|
|
146
|
+
path=_sc_path(user_sub, name), secret=data, mount_point=VAULT_MOUNT)
|
|
147
|
+
|
|
148
|
+
def vault_delete_service_creds(user_sub: str, name: str) -> None:
|
|
149
|
+
client = get_vault_client()
|
|
150
|
+
client.secrets.kv.v2.delete_metadata_and_all_versions(
|
|
151
|
+
path=_sc_path(user_sub, name), mount_point=VAULT_MOUNT)
|
|
@@ -23,9 +23,13 @@ def _validate_transition(current: str, new_status: str, uuid: str) -> None:
|
|
|
23
23
|
"QUEUED": {"CREATE_IN_PROGRESS", "UPDATE_IN_PROGRESS"},
|
|
24
24
|
"CREATE_IN_PROGRESS": {"CREATE_COMPLETE", "CREATE_FAILED", "QUEUED"},
|
|
25
25
|
"UPDATE_IN_PROGRESS": {"UPDATE_FAILED"},
|
|
26
|
-
"CREATE_COMPLETE":
|
|
26
|
+
"CREATE_COMPLETE": {"DELETE_IN_PROGRESS"},
|
|
27
|
+
"DELETE_IN_PROGRESS": {"DELETE_COMPLETE", "DELETE_FAILED"},
|
|
28
|
+
"DELETE_FAILED": {"DELETE_IN_PROGRESS"},
|
|
27
29
|
"CREATE_FAILED": set(),
|
|
28
|
-
"UPDATE_FAILED": set(),
|
|
30
|
+
"UPDATE_FAILED": set(),
|
|
31
|
+
"DELETE_COMPLETE": set(),
|
|
32
|
+
}
|
|
29
33
|
|
|
30
34
|
permitted = allowed.get(current, set())
|
|
31
35
|
if new_status not in permitted:
|
|
@@ -11,6 +11,8 @@ from laniakea_api.auth import fetch_userinfo, create_session_token, verify_sessi
|
|
|
11
11
|
from laniakea_api.models import (OIDCLoginRequest, SessionTokenResponse,UserCredentials,
|
|
12
12
|
CredentialTestRequest, CredentialTestResponse,)
|
|
13
13
|
from laniakea_api.queue import vault_write_credentials, VAULT_MOUNT
|
|
14
|
+
from laniakea_api.queue import (vault_list_service_creds, vault_read_service_creds,
|
|
15
|
+
vault_write_service_creds, vault_delete_service_creds)
|
|
14
16
|
|
|
15
17
|
router = APIRouter()
|
|
16
18
|
|
|
@@ -96,3 +98,23 @@ async def test_openstack_credentials(body: CredentialTestRequest,
|
|
|
96
98
|
detail=str(exc),
|
|
97
99
|
)
|
|
98
100
|
|
|
101
|
+
@router.get("/profile/service_creds")
|
|
102
|
+
async def list_service_creds(caller: dict = Depends(verify_session_token)):
|
|
103
|
+
return vault_list_service_creds(caller["sub"])
|
|
104
|
+
|
|
105
|
+
@router.get("/profile/service_creds/{name}")
|
|
106
|
+
async def read_service_creds(name: str, caller: dict = Depends(verify_session_token)):
|
|
107
|
+
return vault_read_service_creds(caller["sub"], name)
|
|
108
|
+
|
|
109
|
+
@router.put("/profile/service_creds/{name}")
|
|
110
|
+
async def write_service_creds(name: str, body: dict, caller: dict = Depends(verify_session_token)):
|
|
111
|
+
if not name or "/" in name:
|
|
112
|
+
raise HTTPException(status_code=400, detail="Invalid credential name.")
|
|
113
|
+
body = {k: v for k, v in body.items() if v not in (None, "") and k != "name"}
|
|
114
|
+
vault_write_service_creds(caller["sub"], name, body) # KV2: ogni write = nuova versione
|
|
115
|
+
return {"name": name, "saved": True}
|
|
116
|
+
|
|
117
|
+
@router.delete("/profile/service_creds/{name}")
|
|
118
|
+
async def delete_service_creds(name: str, caller: dict = Depends(verify_session_token)):
|
|
119
|
+
vault_delete_service_creds(caller["sub"], name)
|
|
120
|
+
return {"name": name, "deleted": True}
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "laniakea-api-server"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.6"
|
|
8
8
|
description = "Laniakea Queue API — OIDC-authenticated gateway for cloud deployment orchestration"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|