| 212 | } |
| 213 | |
| 214 | func (api *API) persistServerMetadata(name string, ipAddress string, port int, transaction string, version int64) { |
| 215 | newServer := &models.Server{ |
| 216 | Name: name, |
| 217 | Address: ipAddress, |
| 218 | Port: Int64Ptr(port), |
| 219 | Check: models.ServerCheckEnabled, |
| 220 | Inter: Int64Ptr(ServerHealthCheckInterval), // ms; default fall: 3, default rise: 2 |
| 221 | } |
| 222 | |
| 223 | err := api.client.Configuration.CreateServer(DataplaneBackend, newServer, transaction, version) |
| 224 | if err != nil { |
| 225 | logrus.Errorf("Error adding data plane with address %s:%d to the load balancer - %v", ipAddress, port, err) |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | func (api *API) removeServerByName(ipAddress string, port int, transaction string, version int64) { |
| 230 | url := fmt.Sprintf("%s:%d", ipAddress, port) |