mlox.operations
Core operations for interacting with MLOX projects.
This module centralises the business logic used by the different user
interfaces (CLI, TUI, web UI, ...). Each operation returns an
OperationResult which carries a success flag, an error code, a
human-readable message and optional payload data.
The functions are designed to be side-effect free outside of their intended purpose and expose a small cache to avoid repeated session initialisation for the same project credentials.
@dataclass
class
OperationResult:
Container describing the outcome of an operation.
Create or load a project by initialising a session.
def
add_server( project: str, password: str, *, template_path: str, ip: str, port: int, root_user: str, root_password: str, extra_params: Optional[Dict[str, str]] = None) -> OperationResult:
def
add_service( project: str, password: str, *, server_ip: str, template_id: str, params: Optional[Dict[str, str]] = None) -> OperationResult:
def
service_logs( project: str, password: str, *, name: str, label: Optional[str] = None, tail: int = 200) -> OperationResult:
def
invalidate_session_cache(project: Optional[str] = None) -> None:
Clear cached sessions for a project or entirely.