| 158 | } |
| 159 | |
| 160 | func (api *API) RemoveDataplane(ipAddress string, port int, restart bool) { |
| 161 | version, err := api.client.Configuration.GetVersion("") |
| 162 | if err != nil { |
| 163 | logrus.Errorf("Failed to add server to HAProxy backend. Error getting configuration version - %v", err) |
| 164 | return |
| 165 | } |
| 166 | |
| 167 | api.removeServerByName(ipAddress, port, "", version) |
| 168 | |
| 169 | if restart { |
| 170 | api.RestartHAProxy() |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | func (api *API) addServer(ipAddress string, port int, transaction string, version int64) { |
| 175 | name := fmt.Sprintf("%s%d", DataplanePrefix, rand.Int()) |