Complete State
This script defines the CompleteState class for managing the state of the Ankaios cluster.
Classes
- CompleteState:
Represents the complete state of the Ankaios cluster.
Usage
- Create a CompleteState instance:
complete_state = CompleteState()
- Create a CompleteState instance from a Manifest:
manifest = Manifest() complete_state = CompleteState(manifest=manifest)
- Get the API version of the complete state:
api_version = complete_state.get_api_version()
- Get a workload from the complete state:
workload = complete_state.get_workload("nginx")
- Get the entire list of workloads from the complete state:
workloads = complete_state.get_workloads()
- Get the connected agents:
agents = complete_state.get_agents()
- Get the workload states:
workload_states = complete_state.get_workload_states()
CompleteState Class
- class ankaios_sdk._components.complete_state.CompleteState(manifest=None, configs=None, workloads=None, _proto=None)[source]
Bases:
object
A class to represent the complete state.
- __init__(manifest=None, configs=None, workloads=None, _proto=None)[source]
Initializes a CompleteState instance with the provided data.
- Parameters:
- __str__()[source]
Returns the string representation of the complete state.
- Returns:
The string representation of the complete state.
- Return type:
str
- get_api_version()[source]
Gets the API version of the complete state.
- Returns:
The API version of the complete state.
- Return type:
str
- get_workload(workload_name)[source]
Gets a workload from the complete state by its name.
- Parameters:
workload_name (str) – The name of the workload to retrieve.
- Returns:
- The workload with the specified name,
or None if not found.
- Return type:
- get_workloads()[source]
Gets a list of workloads from the complete state.
- Returns:
A list of workloads in the complete state.
- Return type:
list[Workload]
- get_workload_states()[source]
Gets the workload states.
- Returns:
The collection of workload states.
- Return type:
- get_agents()[source]
Gets the connected agents and their attributes.
- Returns:
A dict with the agents and their attributes.
- Return type:
dict[str, dict]
- set_configs(configs)[source]
Sets the configurations in the complete state.
- Parameters:
configs (dict) – The configurations to set in the complete state.
- Return type:
None