(ipAddress string, port int, transaction string, version int64)
| 188 | } |
| 189 | |
| 190 | func (api *API) addRegistrationServer(ipAddress string, port int, transaction string, version int64) { |
| 191 | name := fmt.Sprintf("%s%d", RegistrationServerPrefix, rand.Int()) |
| 192 | |
| 193 | newServer := &models.Server{ |
| 194 | Name: name, |
| 195 | Address: ipAddress, |
| 196 | Port: Int64Ptr(port), |
| 197 | Check: models.ServerCheckEnabled, |
| 198 | Inter: Int64Ptr(ServerHealthCheckInterval), // ms; default fall: 3, default rise: 2 |
| 199 | } |
| 200 | |
| 201 | err := api.client.Configuration.CreateServer(RegistrationServerBackend, newServer, transaction, version) |
| 202 | if err != nil { |
| 203 | logrus.Errorf("Error adding registration server with address %s:%d to the load balancer - %v", ipAddress, port, err) |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | func Int64Ptr(val int) *int64 { |
| 208 | var p = new(int64) |
no test coverage detected