예제 #1
0
        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");
                }
        }
예제 #2
0
 public void Connecting()
 {
     using (var haproxy = new HaProxyClient("127.0.0.1", 8080))
         using (var instance = haproxy.GetInstance())
         {
             Assert.NotNull(instance);
         }
 }
예제 #3
0
 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);
         }
 }
예제 #4
0
 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);
         }
 }
예제 #5
0
 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);
         }
 }