Request
This module defines the Request class for creating and handling requests to the Ankaios system.
Classes
- Request:
Represents the base request to the Ankaios system. It is an abstract class that should be subclassed for specific request types.
- GetStateRequest:
Represents a request to get the state of the Ankaios system.
- UpdateStateRequest:
Represents a request to update the state of the Ankaios system.
- LogsRequest:
Represents a request to get logs from the Ankaios system.
- LogsCancelRequest:
Represents a request to stop the real-time log stream from the Ankaios system.
Usage
- Create a Request for updating the state:
complete_state = CompleteState() request = UpdateStateRequest( complete_state, masks=["desiredState.workloads"] )
- Create a Request for getting the state:
request = GetStateRequest(masks=["desiredState.workloads"])
- Create a Request for getting logs for a workload:
workload_name: WorkloadInstanceName = ... request = LogsRequest(workload_names=[workload_name])
- Create a Request for getting a continuous stream of logs:
workload_name: WorkloadInstanceName = ... request = LogsRequest(workload_names=[workload_name], follow=True)
- Create a Request for stopping the log stream:
request = LogsCancelRequest()
- Get the request ID:
request_id = request.get_id()
Request Class
- class ankaios_sdk._components.request.Request(_id=None)[source]
Bases:
object
Represents a request to the Ankaios system.
- __init__(_id=None)[source]
Initializes a Request instance.
- Parameters:
_id (str) – The request ID. If None, a new UUID will be generated.
- Raises:
TypeError – If the Request class is instantiated directly.
UpdateStateRequest Class
GetStateRequest Class
LogsRequest Class
- class ankaios_sdk._components.request.LogsRequest(workload_names, *, follow=False, tail=-1, since='', until='')[source]
Bases:
Request
Represents a request for getting logs from the Ankaios system.
- __init__(workload_names, *, follow=False, tail=-1, since='', until='')[source]
Initializes an LogsRequest instance.
- Parameters:
workload_names (list[WorkloadInstanceName]) – The workload instance names for which to get logs.
follow (bool) – If true, the logs will be continuously streamed.
tail (int) – The number of lines to display from the end of the logs.
since (str / datetime) – The start time for the logs. If string, it must be in the RFC3339 format.
until (str / datetime) – The end time for the logs. If string, it must be in the RFC3339 format.
- Raises:
ValueError – If no workload names are provided.