Skip to content

RedfishResource

RedfishResource

Redfish API for DMTF BMC compatibility.

Redfish does not use the standard PiKVM response format, so it calls :pymethod:PiKVM.request directly.

Source code in src/aiopikvm/resources/redfish.py
class RedfishResource(BaseResource):
    """Redfish API for DMTF BMC compatibility.

    Redfish does not use the standard PiKVM response format,
    so it calls :pymethod:`PiKVM.request` directly.
    """

    async def reset(self, reset_type: str = "ForceRestart") -> dict[str, Any]:
        """Send a Redfish ComputerSystem.Reset action.

        Args:
            reset_type: The reset type (default ``"ForceRestart"``).

        Returns:
            The JSON response body.
        """
        response = await self._client.request(
            "POST",
            "/api/redfish/v1/Systems/0/Actions/ComputerSystem.Reset",
            json={"ResetType": reset_type},
        )
        try:
            result: dict[str, Any] = response.json()
        except (ValueError, TypeError) as exc:
            raise APIError(f"Invalid JSON response: {response.text[:200]}") from exc
        return result

reset(reset_type='ForceRestart') async

Send a Redfish ComputerSystem.Reset action.

Parameters:

Name Type Description Default
reset_type str

The reset type (default "ForceRestart").

'ForceRestart'

Returns:

Type Description
dict[str, Any]

The JSON response body.

Source code in src/aiopikvm/resources/redfish.py
async def reset(self, reset_type: str = "ForceRestart") -> dict[str, Any]:
    """Send a Redfish ComputerSystem.Reset action.

    Args:
        reset_type: The reset type (default ``"ForceRestart"``).

    Returns:
        The JSON response body.
    """
    response = await self._client.request(
        "POST",
        "/api/redfish/v1/Systems/0/Actions/ComputerSystem.Reset",
        json={"ResetType": reset_type},
    )
    try:
        result: dict[str, Any] = response.json()
    except (ValueError, TypeError) as exc:
        raise APIError(f"Invalid JSON response: {response.text[:200]}") from exc
    return result