Request
This module defines the Request class for creating and handling requests to the Ankaios system.
Classes
- Request:
Represents a request to the Ankaios system and provides methods to get and set the state of the system.
Enums
- RequestType:
Enumeration for the different types of requests. It includes UPDATE_STATE and GET_STATE.
Usage
- Create a Request for updating the state:
request = Request(RequestType.UPDATE_STATE) request.set_complete_state(complete_state)
- Create a Request for getting the state:
request = Request(RequestType.GET_STATE)
- Get the request ID:
request_id = request.get_id()
- Add a mask to the request:
request.add_mask("desiredState.workloads")
Request Class
- class ankaios_sdk._components.request.Request(request_type)[source]
Bases:
object
Represents a request to the Ankaios system.
- __init__(request_type)[source]
Initializes a Request instance with the given request type.
- Parameters:
request_type (RequestType) – The type of the request.
- Raises:
RequestException – If the request type is invalid.
- __str__()[source]
Returns the string representation of the request.
- Returns:
The string representation of the request.
- Return type:
str
- set_complete_state(complete_state)[source]
Sets the complete state for the request.
- Parameters:
complete_state (CompleteState) – The complete state to set for the request.
- Raises:
RequestException – If the request type is not UPDATE_STATE.
- Return type:
None