22 lines
377 B
Go
22 lines
377 B
Go
|
package eureka
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func (c *Client) RegisterInstance(appId string, instanceInfo *InstanceInfo) error {
|
||
|
values := []string{"apps", appId}
|
||
|
path := strings.Join(values, "/")
|
||
|
instance := &Instance{
|
||
|
Instance: instanceInfo,
|
||
|
}
|
||
|
body, err := json.Marshal(instance)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
_, err = c.Post(path, body)
|
||
|
return err
|
||
|
}
|