| 1 | from consul.callback import CB |
| 2 | |
| 3 | |
| 4 | class Status: |
| 5 | """ |
| 6 | The Status endpoints are used to get information about the status |
| 7 | of the Consul cluster. |
| 8 | """ |
| 9 | |
| 10 | def __init__(self, agent) -> None: |
| 11 | self.agent = agent |
| 12 | |
| 13 | def leader(self): |
| 14 | """ |
| 15 | This endpoint is used to get the Raft leader for the datacenter |
| 16 | in which the agent is running. |
| 17 | """ |
| 18 | return self.agent.http.get(CB.json(), "/v1/status/leader") |
| 19 | |
| 20 | def peers(self): |
| 21 | """ |
| 22 | This endpoint retrieves the Raft peers for the datacenter in which |
| 23 | the the agent is running. |
| 24 | """ |
| 25 | return self.agent.http.get(CB.json(), "/v1/status/peers") |