mirror of
https://github.com/datarhei/core.git
synced 2025-10-09 09:50:15 +08:00
Add /v1/core/config endpoint to cluster API client
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/datarhei/core/v16/config"
|
||||||
httpapi "github.com/datarhei/core/v16/http/api"
|
httpapi "github.com/datarhei/core/v16/http/api"
|
||||||
iamaccess "github.com/datarhei/core/v16/iam/access"
|
iamaccess "github.com/datarhei/core/v16/iam/access"
|
||||||
iamidentity "github.com/datarhei/core/v16/iam/identity"
|
iamidentity "github.com/datarhei/core/v16/iam/identity"
|
||||||
@@ -89,6 +90,21 @@ func (c *APIClient) CoreAPIAddress() (string, error) {
|
|||||||
return address, nil
|
return address, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *APIClient) CoreConfig() (*config.Config, error) {
|
||||||
|
data, err := c.call(http.MethodGet, "/v1/core/config", "", nil, "")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := &config.Config{}
|
||||||
|
err = json.Unmarshal(data, &cfg)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return cfg, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *APIClient) Join(origin string, r JoinRequest) error {
|
func (c *APIClient) Join(origin string, r JoinRequest) error {
|
||||||
data, err := json.Marshal(&r)
|
data, err := json.Marshal(&r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user