Refactor cluster node code

This commit is contained in:
Ingo Oppermann
2024-07-09 12:26:02 +02:00
parent 28603aab98
commit 480dbb7f53
136 changed files with 5110 additions and 8272 deletions

26
cluster/client/lock.go Normal file
View File

@@ -0,0 +1,26 @@
package client
import (
"bytes"
"net/http"
"net/url"
"github.com/datarhei/core/v16/encoding/json"
)
func (c *APIClient) LockCreate(origin string, r LockRequest) error {
data, err := json.Marshal(r)
if err != nil {
return err
}
_, err = c.call(http.MethodPost, "/v1/lock", "application/json", bytes.NewReader(data), origin)
return err
}
func (c *APIClient) LockDelete(origin string, name string) error {
_, err := c.call(http.MethodDelete, "/v1/lock/"+url.PathEscape(name), "application/json", nil, origin)
return err
}