mirror of
https://github.com/0x1d/rcond.git
synced 2025-12-14 18:25:21 +01:00
docs: describe cluster events
This commit is contained in:
16
README.md
16
README.md
@@ -171,7 +171,7 @@ Following events are implemented:
|
||||
This example will automatically connect to a WiFi access point with the given SSID and password on the interface "wlan0".
|
||||
|
||||
```bash
|
||||
curl -sSf -X POST "http://rpi-test:8080/network/sta" \
|
||||
curl -X POST "http://rpi-test:8080/network/sta" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Token: 1234567890" \
|
||||
-d '{
|
||||
@@ -187,7 +187,7 @@ curl -sSf -X POST "http://rpi-test:8080/network/sta" \
|
||||
This example will create an access point on the interface "wlan0" with the given SSID and password.
|
||||
|
||||
```bash
|
||||
curl -sSf -X POST "http://rpi-test:8080/network/ap" \
|
||||
curl -X POST "http://rpi-test:8080/network/ap" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Token: 1234567890" \
|
||||
-d '{
|
||||
@@ -197,3 +197,15 @@ curl -sSf -X POST "http://rpi-test:8080/network/ap" \
|
||||
"autoconnect": true
|
||||
}'
|
||||
```
|
||||
### Restart the cluster
|
||||
|
||||
This example will restart all nodes in the cluster
|
||||
|
||||
```bash
|
||||
curl -X POST "http://rpi-test:8080/cluster/event" \
|
||||
-H "accept: application/json" \
|
||||
-H "X-API-Token: 1234567890" \
|
||||
-d '{
|
||||
"name": "restart"
|
||||
}'
|
||||
```
|
||||
@@ -304,6 +304,10 @@ func HandleClusterMembers(w http.ResponseWriter, r *http.Request, agent *cluster
|
||||
}
|
||||
|
||||
func HandleClusterEvent(w http.ResponseWriter, r *http.Request, agent *cluster.Agent) {
|
||||
if agent == nil {
|
||||
writeError(w, "cluster agent is not initialized", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
var req clusterEventRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
writeError(w, err.Error(), http.StatusBadRequest)
|
||||
|
||||
Reference in New Issue
Block a user