From c3fc3170f200d3e1f9cada140108d26bd28acca4 Mon Sep 17 00:00:00 2001 From: Pablo RUTH Date: Fri, 7 Dec 2018 11:54:21 +0100 Subject: [PATCH] add ClientSSLProfile and HTTP2HTTPS fields to virtual server structs --- loadbalance_test.go | 1 + loadbalance_virtual_server.go | 4 ++++ loadbalance_virtual_server_test.go | 36 +++++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/loadbalance_test.go b/loadbalance_test.go index 6bac30c..228f538 100644 --- a/loadbalance_test.go +++ b/loadbalance_test.go @@ -156,6 +156,7 @@ func TestLoadbalance(t *testing.T) { Profile: "LB_PROF_TCP", Method: "LB_METHOD_ROUND_ROBIN", Pool: "GOFORTI_POOL", + HTTP2HTTPS: "enable", } t.Logf("reqCreateVirtualServer: %+v", reqCreateVirtualServer) diff --git a/loadbalance_virtual_server.go b/loadbalance_virtual_server.go index 2766604..403027f 100644 --- a/loadbalance_virtual_server.go +++ b/loadbalance_virtual_server.go @@ -34,6 +34,7 @@ type LoadbalanceVirtualServerReq struct { ContentRoutingList string `json:"content-routing-list"` ContentRewritingList string `json:"content-rewriting-list"` Profile string `json:"profile"` + ClientSSLProfile string `json:"client_ssl_profile"` Persistence string `json:"persistence"` Method string `json:"method"` Pool string `json:"pool"` @@ -42,6 +43,7 @@ type LoadbalanceVirtualServerReq struct { WafProfile string `json:"waf-profile"` AuthPolicy string `json:"auth_policy"` Scripting string `json:"scripting"` + HTTP2HTTPS string `json:"http2https"` } // LoadbalanceVirtualServerRes represents a virtual server response @@ -81,6 +83,8 @@ type LoadbalanceVirtualServerRes struct { Nondeletable int `json:"_nondeletable"` Noneditable int `json:"_noneditable"` CurrentStatus int `json:"current-status"` + ClientSSLProfile string `json:"client_ssl_profile"` + HTTP2HTTPS string `json:"http2https"` } // LoadbalanceGetVirtualServers returns the list of all virtaul servers diff --git a/loadbalance_virtual_server_test.go b/loadbalance_virtual_server_test.go index 253f1ec..8a86cf3 100644 --- a/loadbalance_virtual_server_test.go +++ b/loadbalance_virtual_server_test.go @@ -17,7 +17,7 @@ func TestClient_LoadbalanceGetVirtualServers(t *testing.T) { } } -func TestClient_LoadbalanceCreateVirtualServer(t *testing.T) { +func TestClient_LoadbalanceCreateVirtualServerL4(t *testing.T) { client, err := NewClientHelper() if err != nil { t.Fatal(err) @@ -51,6 +51,40 @@ func TestClient_LoadbalanceCreateVirtualServer(t *testing.T) { } } +func TestClient_LoadbalanceCreateVirtualServerL7(t *testing.T) { + client, err := NewClientHelper() + if err != nil { + t.Fatal(err) + } + + req := LoadbalanceVirtualServerReq{ + Status: "enable", + Type: "l7-load-balance", + AddrType: "ipv4", + Address: "128.1.201.36", + Port: "8443", + PortRange: "0", + ConnectionLimit: "10000", + ContentRouting: "disable", + Warmup: "0", + Warmrate: "10", + ConnectionRateLimit: "0", + Log: "disable", + Alone: "enable", + Mkey: "GOFORTI-VS", + Interface: "port1", + Profile: "LB_PROF_HTTPS_XF-ORWARDED-FOR", + Method: "LB_METHOD_ROUND_ROBIN", + Pool: "GOFORTI_POOL", + ClientSSLProfile: "LB_CLIENT_SSL", + } + + err = client.LoadbalanceCreateVirtualServer(req) + if err != nil { + t.Fatal(err) + } +} + func TestClient_LoadbalanceUpdateVirtualServer(t *testing.T) { client, err := NewClientHelper() if err != nil {