Skip to content

platforms

platforms

API router for platform information.

list_platforms() async

List all supported platforms.

Source code in hier_config_api/routers/platforms.py
@router.get("", response_model=list[PlatformInfo])
async def list_platforms() -> list[PlatformInfo]:
    """List all supported platforms."""
    try:
        return PlatformService.list_platforms()
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"Failed to list platforms: {str(e)}") from e

get_platform_rules(platform) async

Get platform-specific rules and behaviors.

Source code in hier_config_api/routers/platforms.py
@router.get("/{platform}/rules", response_model=PlatformRules)
async def get_platform_rules(platform: str) -> PlatformRules:
    """Get platform-specific rules and behaviors."""
    try:
        return PlatformService.get_platform_rules(platform)
    except Exception as e:
        raise HTTPException(
            status_code=400, detail=f"Failed to get platform rules: {str(e)}"
        ) from e

validate_config(platform, request) async

Validate configuration for a specific platform.

Source code in hier_config_api/routers/platforms.py
@router.post("/{platform}/validate", response_model=ValidateConfigResponse)
async def validate_config(platform: str, request: ValidateConfigRequest) -> ValidateConfigResponse:
    """Validate configuration for a specific platform."""
    try:
        result = PlatformService.validate_config(platform, request.config_text)
        return ValidateConfigResponse(**result)
    except Exception as e:
        raise HTTPException(status_code=400, detail=f"Failed to validate config: {str(e)}") from e