static void Main(string[] args) { // https://github.com/clintnetwork/HaProxy.Api Console.WriteLine("Hello World!"); using (var haproxy = new HaProxyClient("172.16.12.225", 9999)) using (var instance = haproxy.GetInstance()) { // Get the help message Console.WriteLine(instance.Help()); string errors = instance.ShowErrors(); Console.WriteLine(errors); // Get all the backends var backends = instance.ShowBackend(); foreach (var backend in backends) { Console.WriteLine(backend); } // Disable the "http-in" frontend instance.DisableFrontend("http-in"); // Re-enable it instance.EnableFrontend("http-in"); } }
public void Connecting() { using (var haproxy = new HaProxyClient("127.0.0.1", 8080)) using (var instance = haproxy.GetInstance()) { Assert.NotNull(instance); } }
public void SendRaw() { using (var haproxy = new HaProxyClient("127.0.0.1", 8080)) using (var instance = haproxy.GetInstance()) { var response = instance.SendRaw("show errors"); Assert.NotEmpty(response); } }
public void ShowBackend() { using (var haproxy = new HaProxyClient("127.0.0.1", 8080)) using (var instance = haproxy.GetInstance()) { var backends = instance.ShowBackend(); Assert.NotEmpty(backends); } }
public void ShowErrors() { using (var haproxy = new HaProxyClient("127.0.0.1", 8080)) using (var instance = haproxy.GetInstance()) { var errors = instance.ShowErrors(); Assert.NotEmpty(errors); } }