27 lines
1.6 KiB
Python
27 lines
1.6 KiB
Python
"""Non-sensitive control-plane snapshot assembly."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Mapping
|
|
|
|
|
|
def _copy(value: Mapping[str, Any] | None, keys: tuple[str, ...]) -> dict[str, Any]:
|
|
value = value or {}
|
|
return {key: value.get(key) for key in keys}
|
|
|
|
|
|
def build_control_plane_snapshot(*, target_version: str, runtime: Mapping[str, Any] | None = None, repository: Mapping[str, Any] | None = None, production: Mapping[str, Any] | None = None, task: Mapping[str, Any] | None = None, capabilities: Mapping[str, Any] | None = None, credential_broker: Mapping[str, Any] | None = None) -> dict[str, Any]:
|
|
return {
|
|
"version": {"target_release": target_version},
|
|
"runtime": _copy(runtime, ("bridge_schema_version", "control_plane_release_version", "runtime_release_commit", "runtime_path", "artifact_sha256", "drift_status")),
|
|
"repository": _copy(repository, ("identity", "authority_git_dir", "authority_main_oid")),
|
|
"production": _copy(production, ("baseline_version", "target_oid", "deployment_state")),
|
|
"task": _copy(task, ("task_id", "branch", "authority_branch_oid", "gitea_git_oid", "gitea_api_oid", "commit_visible", "generation", "reconciliation_state")),
|
|
"capabilities": _copy(capabilities, ("legacy_writes_enabled", "governed_writes_enabled", "force_push", "main_write", "tag_write", "baseline_write", "production_write")),
|
|
"credential_broker": _copy(credential_broker, ("status", "provider")),
|
|
"secret_material_exposed": False,
|
|
}
|
|
|
|
|
|
def getControlPlaneSnapshot(**kwargs: Any) -> dict[str, Any]:
|
|
return build_control_plane_snapshot(**kwargs)
|