From d341eda459b28af7d5a6c40894260be3fc72e550 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Fri, 19 Jul 2024 12:25:05 +0900 Subject: [PATCH 1/5] gh-726 Initial support for basic ingress support (w/HTTPS) based on http host header --- api/models/loadbalance_entry.go | 6 +- api/restapi/configure_loxilb_rest_api.go | 2 +- api/restapi/embedded_spec.go | 188 +++++----- api/restapi/handler/loadbalancer.go | 14 +- ...ess_ip_address_port_port_protocol_proto.go | 58 --- ...ess_port_port_protocol_proto_parameters.go | 216 ----------- ...ress_port_port_protocol_proto_responses.go | 354 ------------------ ...ess_port_port_protocol_proto_urlbuilder.go | 148 -------- api/restapi/operations/loxilb_rest_api_api.go | 20 +- common/common.go | 4 +- loxilb-ebpf | 2 +- pkg/loxinet/dpbroker.go | 3 +- pkg/loxinet/dpebpf_linux.go | 165 ++++---- pkg/loxinet/rules.go | 13 +- 14 files changed, 212 insertions(+), 981 deletions(-) delete mode 100644 api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto.go delete mode 100644 api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_parameters.go delete mode 100644 api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_responses.go delete mode 100644 api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_urlbuilder.go diff --git a/api/models/loadbalance_entry.go b/api/models/loadbalance_entry.go index 2921da163..73bce189d 100644 --- a/api/models/loadbalance_entry.go +++ b/api/models/loadbalance_entry.go @@ -318,6 +318,9 @@ type LoadbalanceEntryServiceArguments struct { // IP address for externel access ExternalIP string `json:"externalIP,omitempty"` + // Ingress specific host URL path + Host string `json:"host,omitempty"` + // value for inactivity timeout (in seconds) InactiveTimeOut int32 `json:"inactiveTimeOut,omitempty"` @@ -336,9 +339,6 @@ type LoadbalanceEntryServiceArguments struct { // end-point specific op (0-create, 1-attachEP, 2-detachEP) Oper int32 `json:"oper,omitempty"` - // Ingress specific URL path - Path string `json:"path,omitempty"` - // port number for the access Port int64 `json:"port,omitempty"` diff --git a/api/restapi/configure_loxilb_rest_api.go b/api/restapi/configure_loxilb_rest_api.go index 1f1450cf0..8d2735c45 100644 --- a/api/restapi/configure_loxilb_rest_api.go +++ b/api/restapi/configure_loxilb_rest_api.go @@ -60,7 +60,7 @@ func configureAPI(api *operations.LoxilbRestAPIAPI) http.Handler { // Load balancer add and delete and get api.PostConfigLoadbalancerHandler = operations.PostConfigLoadbalancerHandlerFunc(handler.ConfigPostLoadbalancer) - api.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler = operations.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(handler.ConfigDeleteLoadbalancer) + api.DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler = operations.DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(handler.ConfigDeleteLoadbalancer) api.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler = operations.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(handler.ConfigDeleteLoadbalancerWithoutPath) api.GetConfigLoadbalancerAllHandler = operations.GetConfigLoadbalancerAllHandlerFunc(handler.ConfigGetLoadbalancer) api.DeleteConfigLoadbalancerAllHandler = operations.DeleteConfigLoadbalancerAllHandlerFunc(handler.ConfigDeleteAllLoadbalancer) diff --git a/api/restapi/embedded_spec.go b/api/restapi/embedded_spec.go index 248fe3775..12c96930c 100644 --- a/api/restapi/embedded_spec.go +++ b/api/restapi/embedded_spec.go @@ -2124,17 +2124,50 @@ func init() { } } }, - "/config/loadbalancer/name/{lb_name}": { + "/config/loadbalancer/hosturl/{hosturl}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}": { "delete": { - "description": "Delete an existing load balancer service with name.", + "description": "Delete an existing load balancer service with .", "summary": "Delete an existing Load balancer service", "parameters": [ { "type": "string", - "description": "Attributes for load balance service name", - "name": "lb_name", + "description": "Attributes for load balance service", + "name": "hosturl", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Attributes for load balance service", + "name": "ip_address", + "in": "path", + "required": true + }, + { + "type": "number", + "description": "Attributes for load balance service", + "name": "port", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Attributes for load balance service", + "name": "proto", "in": "path", "required": true + }, + { + "type": "boolean", + "description": "option for BGP enable", + "name": "bgp", + "in": "query" + }, + { + "type": "number", + "description": "block value if any", + "name": "block", + "in": "query" } ], "responses": { @@ -2186,50 +2219,17 @@ func init() { } } }, - "/config/loadbalancer/urlpath/{urlpath}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}": { + "/config/loadbalancer/name/{lb_name}": { "delete": { - "description": "Delete an existing load balancer service with .", + "description": "Delete an existing load balancer service with name.", "summary": "Delete an existing Load balancer service", "parameters": [ { "type": "string", - "description": "Attributes for load balance service", - "name": "urlpath", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Attributes for load balance service", - "name": "ip_address", - "in": "path", - "required": true - }, - { - "type": "number", - "description": "Attributes for load balance service", - "name": "port", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Attributes for load balance service", - "name": "proto", + "description": "Attributes for load balance service name", + "name": "lb_name", "in": "path", "required": true - }, - { - "type": "boolean", - "description": "option for BGP enable", - "name": "bgp", - "in": "query" - }, - { - "type": "number", - "description": "block value if any", - "name": "block", - "in": "query" } ], "responses": { @@ -5018,6 +5018,10 @@ func init() { "description": "IP address for externel access", "type": "string" }, + "host": { + "description": "Ingress specific host URL path", + "type": "string" + }, "inactiveTimeOut": { "description": "value for inactivity timeout (in seconds)", "type": "integer", @@ -5045,10 +5049,6 @@ func init() { "type": "integer", "format": "int32" }, - "path": { - "description": "Ingress specific URL path", - "type": "string" - }, "port": { "description": "port number for the access", "type": "integer" @@ -7831,17 +7831,50 @@ func init() { } } }, - "/config/loadbalancer/name/{lb_name}": { + "/config/loadbalancer/hosturl/{hosturl}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}": { "delete": { - "description": "Delete an existing load balancer service with name.", + "description": "Delete an existing load balancer service with .", "summary": "Delete an existing Load balancer service", "parameters": [ { "type": "string", - "description": "Attributes for load balance service name", - "name": "lb_name", + "description": "Attributes for load balance service", + "name": "hosturl", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Attributes for load balance service", + "name": "ip_address", + "in": "path", + "required": true + }, + { + "type": "number", + "description": "Attributes for load balance service", + "name": "port", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Attributes for load balance service", + "name": "proto", "in": "path", "required": true + }, + { + "type": "boolean", + "description": "option for BGP enable", + "name": "bgp", + "in": "query" + }, + { + "type": "number", + "description": "block value if any", + "name": "block", + "in": "query" } ], "responses": { @@ -7893,50 +7926,17 @@ func init() { } } }, - "/config/loadbalancer/urlpath/{urlpath}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}": { + "/config/loadbalancer/name/{lb_name}": { "delete": { - "description": "Delete an existing load balancer service with .", + "description": "Delete an existing load balancer service with name.", "summary": "Delete an existing Load balancer service", "parameters": [ { "type": "string", - "description": "Attributes for load balance service", - "name": "urlpath", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Attributes for load balance service", - "name": "ip_address", - "in": "path", - "required": true - }, - { - "type": "number", - "description": "Attributes for load balance service", - "name": "port", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Attributes for load balance service", - "name": "proto", + "description": "Attributes for load balance service name", + "name": "lb_name", "in": "path", "required": true - }, - { - "type": "boolean", - "description": "option for BGP enable", - "name": "bgp", - "in": "query" - }, - { - "type": "number", - "description": "block value if any", - "name": "block", - "in": "query" } ], "responses": { @@ -11154,6 +11154,10 @@ func init() { "description": "IP address for externel access", "type": "string" }, + "host": { + "description": "Ingress specific host URL path", + "type": "string" + }, "inactiveTimeOut": { "description": "value for inactivity timeout (in seconds)", "type": "integer", @@ -11181,10 +11185,6 @@ func init() { "type": "integer", "format": "int32" }, - "path": { - "description": "Ingress specific URL path", - "type": "string" - }, "port": { "description": "port number for the access", "type": "integer" @@ -11285,6 +11285,10 @@ func init() { "description": "IP address for externel access", "type": "string" }, + "host": { + "description": "Ingress specific host URL path", + "type": "string" + }, "inactiveTimeOut": { "description": "value for inactivity timeout (in seconds)", "type": "integer", @@ -11312,10 +11316,6 @@ func init() { "type": "integer", "format": "int32" }, - "path": { - "description": "Ingress specific URL path", - "type": "string" - }, "port": { "description": "port number for the access", "type": "integer" diff --git a/api/restapi/handler/loadbalancer.go b/api/restapi/handler/loadbalancer.go index f40daca8d..22a21a267 100644 --- a/api/restapi/handler/loadbalancer.go +++ b/api/restapi/handler/loadbalancer.go @@ -47,7 +47,7 @@ func ConfigPostLoadbalancer(params operations.PostConfigLoadbalancerParams) midd lbRules.Serv.ProbeRetries = int(params.Attr.ServiceArguments.ProbeRetries) lbRules.Serv.Name = params.Attr.ServiceArguments.Name lbRules.Serv.Oper = cmn.LBOp(params.Attr.ServiceArguments.Oper) - lbRules.Serv.Path = params.Attr.ServiceArguments.Path + lbRules.Serv.HostUrl = params.Attr.ServiceArguments.Host if lbRules.Serv.Proto == "sctp" { for _, data := range params.Attr.SecondaryIPs { @@ -78,7 +78,7 @@ func ConfigPostLoadbalancer(params operations.PostConfigLoadbalancerParams) midd return &ResultResponse{Result: "Success"} } -func ConfigDeleteLoadbalancer(params operations.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder { +func ConfigDeleteLoadbalancer(params operations.DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder { tk.LogIt(tk.LogDebug, "[API] Load balancer %s API called. url : %s\n", params.HTTPRequest.Method, params.HTTPRequest.URL) var lbServ cmn.LbServiceArg @@ -86,10 +86,10 @@ func ConfigDeleteLoadbalancer(params operations.DeleteConfigLoadbalancerUrlpathU lbServ.ServIP = params.IPAddress lbServ.ServPort = uint16(params.Port) lbServ.Proto = params.Proto - if params.Urlpath == "any" { - lbServ.Path = "" + if params.Hosturl == "any" { + lbServ.HostUrl = "" } else { - lbServ.Path = params.Urlpath + lbServ.HostUrl = params.Hosturl } if params.Block != nil { lbServ.BlockNum = uint16(*params.Block) @@ -116,7 +116,7 @@ func ConfigDeleteLoadbalancerWithoutPath(params operations.DeleteConfigLoadbalan lbServ.ServIP = params.IPAddress lbServ.ServPort = uint16(params.Port) lbServ.Proto = params.Proto - lbServ.Path = "" + lbServ.HostUrl = "" if params.Block != nil { lbServ.BlockNum = uint16(*params.Block) } @@ -165,7 +165,7 @@ func ConfigGetLoadbalancer(params operations.GetConfigLoadbalancerAllParams) mid tmpSvc.Probeport = lb.Serv.ProbePort tmpSvc.Name = lb.Serv.Name tmpSvc.Snat = lb.Serv.Snat - tmpSvc.Path = lb.Serv.Path + tmpSvc.Host = lb.Serv.HostUrl tmpLB.ServiceArguments = &tmpSvc diff --git a/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto.go b/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto.go deleted file mode 100644 index 7a3bdddf3..000000000 --- a/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package operations - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc turns a function with the right signature into a delete config loadbalancer urlpath urlpath externalipaddress IP address port port protocol proto handler -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc func(DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc) Handle(params DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder { - return fn(params) -} - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler interface for that can handle valid delete config loadbalancer urlpath urlpath externalipaddress IP address port port protocol proto params -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler interface { - Handle(DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder -} - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto creates a new http.Handler for the delete config loadbalancer urlpath urlpath externalipaddress IP address port port protocol proto operation -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto(ctx *middleware.Context, handler DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler) *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto { - return &DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto{Context: ctx, Handler: handler} -} - -/* - DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto swagger:route DELETE /config/loadbalancer/urlpath/{urlpath}/externalipaddress/{ip_address}/port/{port}/protocol/{proto} deleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIpAddressPortPortProtocolProto - -# Delete an existing Load balancer service - -Delete an existing load balancer service with . -*/ -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto struct { - Context *middleware.Context - Handler DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler -} - -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_parameters.go b/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_parameters.go deleted file mode 100644 index dcc2939f9..000000000 --- a/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_parameters.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package operations - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams creates a new DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams object -// -// There are no default values defined in the spec. -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams() DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams { - - return DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams{} -} - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams contains all the bound params for the delete config loadbalancer urlpath urlpath externalipaddress IP address port port protocol proto operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*option for BGP enable - In: query - */ - Bgp *bool - /*block value if any - In: query - */ - Block *float64 - /*Attributes for load balance service - Required: true - In: path - */ - IPAddress string - /*Attributes for load balance service - Required: true - In: path - */ - Port float64 - /*Attributes for load balance service - Required: true - In: path - */ - Proto string - /*Attributes for load balance service - Required: true - In: path - */ - Urlpath string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams() beforehand. -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qBgp, qhkBgp, _ := qs.GetOK("bgp") - if err := o.bindBgp(qBgp, qhkBgp, route.Formats); err != nil { - res = append(res, err) - } - - qBlock, qhkBlock, _ := qs.GetOK("block") - if err := o.bindBlock(qBlock, qhkBlock, route.Formats); err != nil { - res = append(res, err) - } - - rIPAddress, rhkIPAddress, _ := route.Params.GetOK("ip_address") - if err := o.bindIPAddress(rIPAddress, rhkIPAddress, route.Formats); err != nil { - res = append(res, err) - } - - rPort, rhkPort, _ := route.Params.GetOK("port") - if err := o.bindPort(rPort, rhkPort, route.Formats); err != nil { - res = append(res, err) - } - - rProto, rhkProto, _ := route.Params.GetOK("proto") - if err := o.bindProto(rProto, rhkProto, route.Formats); err != nil { - res = append(res, err) - } - - rUrlpath, rhkUrlpath, _ := route.Params.GetOK("urlpath") - if err := o.bindUrlpath(rUrlpath, rhkUrlpath, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBgp binds and validates parameter Bgp from query. -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) bindBgp(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("bgp", "query", "bool", raw) - } - o.Bgp = &value - - return nil -} - -// bindBlock binds and validates parameter Block from query. -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) bindBlock(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertFloat64(raw) - if err != nil { - return errors.InvalidType("block", "query", "float64", raw) - } - o.Block = &value - - return nil -} - -// bindIPAddress binds and validates parameter IPAddress from path. -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) bindIPAddress(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.IPAddress = raw - - return nil -} - -// bindPort binds and validates parameter Port from path. -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) bindPort(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertFloat64(raw) - if err != nil { - return errors.InvalidType("port", "path", "float64", raw) - } - o.Port = value - - return nil -} - -// bindProto binds and validates parameter Proto from path. -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) bindProto(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Proto = raw - - return nil -} - -// bindUrlpath binds and validates parameter Urlpath from path. -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) bindUrlpath(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Urlpath = raw - - return nil -} diff --git a/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_responses.go b/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_responses.go deleted file mode 100644 index 7a9fd307f..000000000 --- a/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_responses.go +++ /dev/null @@ -1,354 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package operations - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/loxilb-io/loxilb/api/models" -) - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContentCode is the HTTP code returned for type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContent -const DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContentCode int = 204 - -/* -DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContent OK - -swagger:response deleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIpAddressPortPortProtocolProtoNoContent -*/ -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContent struct { -} - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContent creates DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContent with default headers values -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContent() *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContent { - - return &DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContent{} -} - -// WriteResponse to the client -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequestCode is the HTTP code returned for type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest -const DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequestCode int = 400 - -/* -DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest Malformed arguments for API call - -swagger:response deleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIpAddressPortPortProtocolProtoBadRequest -*/ -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest struct { - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest creates DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest with default headers values -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest() *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest { - - return &DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest{} -} - -// WithPayload adds the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto bad request response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto bad request response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorizedCode is the HTTP code returned for type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized -const DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorizedCode int = 401 - -/* -DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized Invalid authentication credentials - -swagger:response deleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIpAddressPortPortProtocolProtoUnauthorized -*/ -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized struct { - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized creates DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized with default headers values -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized() *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized { - - return &DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized{} -} - -// WithPayload adds the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto unauthorized response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto unauthorized response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(401) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbiddenCode is the HTTP code returned for type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden -const DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbiddenCode int = 403 - -/* -DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden Capacity insufficient - -swagger:response deleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIpAddressPortPortProtocolProtoForbidden -*/ -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden struct { - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden creates DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden with default headers values -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden() *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden { - - return &DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden{} -} - -// WithPayload adds the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto forbidden response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto forbidden response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(403) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFoundCode is the HTTP code returned for type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound -const DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFoundCode int = 404 - -/* -DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound Resource not found - -swagger:response deleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIpAddressPortPortProtocolProtoNotFound -*/ -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound struct { - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound creates DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound with default headers values -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound() *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound { - - return &DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound{} -} - -// WithPayload adds the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto not found response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto not found response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflictCode is the HTTP code returned for type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict -const DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflictCode int = 409 - -/* -DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict Resource Conflict. VLAN already exists OR dependency VRF/VNET not found - -swagger:response deleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIpAddressPortPortProtocolProtoConflict -*/ -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict struct { - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict creates DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict with default headers values -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict() *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict { - - return &DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict{} -} - -// WithPayload adds the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto conflict response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto conflict response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerErrorCode is the HTTP code returned for type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError -const DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerErrorCode int = 500 - -/* -DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError Internal service error - -swagger:response deleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIpAddressPortPortProtocolProtoInternalServerError -*/ -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError struct { - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError creates DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError with default headers values -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError() *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError { - - return &DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError{} -} - -// WithPayload adds the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto internal server error response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto internal server error response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(500) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailableCode is the HTTP code returned for type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable -const DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailableCode int = 503 - -/* -DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable Maintanence mode - -swagger:response deleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIpAddressPortPortProtocolProtoServiceUnavailable -*/ -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable struct { - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable creates DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable with default headers values -func NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable() *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable { - - return &DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable{} -} - -// WithPayload adds the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto service unavailable response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete config loadbalancer urlpath urlpath externalipaddress Ip address port port protocol proto service unavailable response -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(503) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_urlbuilder.go b/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_urlbuilder.go deleted file mode 100644 index aa3a8c5ee..000000000 --- a/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package operations - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL generates an URL for the delete config loadbalancer urlpath urlpath externalipaddress IP address port port protocol proto operation -type DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL struct { - IPAddress string - Port float64 - Proto string - Urlpath string - - Bgp *bool - Block *float64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL) WithBasePath(bp string) *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/config/loadbalancer/urlpath/{urlpath}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}" - - iPAddress := o.IPAddress - if iPAddress != "" { - _path = strings.Replace(_path, "{ip_address}", iPAddress, -1) - } else { - return nil, errors.New("ipAddress is required on DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL") - } - - port := swag.FormatFloat64(o.Port) - if port != "" { - _path = strings.Replace(_path, "{port}", port, -1) - } else { - return nil, errors.New("port is required on DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL") - } - - proto := o.Proto - if proto != "" { - _path = strings.Replace(_path, "{proto}", proto, -1) - } else { - return nil, errors.New("proto is required on DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL") - } - - urlpath := o.Urlpath - if urlpath != "" { - _path = strings.Replace(_path, "{urlpath}", urlpath, -1) - } else { - return nil, errors.New("urlpath is required on DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/netlox/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var bgpQ string - if o.Bgp != nil { - bgpQ = swag.FormatBool(*o.Bgp) - } - if bgpQ != "" { - qs.Set("bgp", bgpQ) - } - - var blockQ string - if o.Block != nil { - blockQ = swag.FormatFloat64(*o.Block) - } - if blockQ != "" { - qs.Set("block", blockQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/restapi/operations/loxilb_rest_api_api.go b/api/restapi/operations/loxilb_rest_api_api.go index 9d571cd3b..4d0909b75 100644 --- a/api/restapi/operations/loxilb_rest_api_api.go +++ b/api/restapi/operations/loxilb_rest_api_api.go @@ -75,12 +75,12 @@ func NewLoxilbRestAPIAPI(spec *loads.Document) *LoxilbRestAPIAPI { DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler: DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(func(params DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder { return middleware.NotImplemented("operation DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProto has not yet been implemented") }), + DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler: DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(func(params DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder { + return middleware.NotImplemented("operation DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto has not yet been implemented") + }), DeleteConfigLoadbalancerNameLbNameHandler: DeleteConfigLoadbalancerNameLbNameHandlerFunc(func(params DeleteConfigLoadbalancerNameLbNameParams) middleware.Responder { return middleware.NotImplemented("operation DeleteConfigLoadbalancerNameLbName has not yet been implemented") }), - DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler: DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(func(params DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder { - return middleware.NotImplemented("operation DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto has not yet been implemented") - }), DeleteConfigMirrorIdentIdentHandler: DeleteConfigMirrorIdentIdentHandlerFunc(func(params DeleteConfigMirrorIdentIdentParams) middleware.Responder { return middleware.NotImplemented("operation DeleteConfigMirrorIdentIdent has not yet been implemented") }), @@ -313,10 +313,10 @@ type LoxilbRestAPIAPI struct { DeleteConfigLoadbalancerAllHandler DeleteConfigLoadbalancerAllHandler // DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler sets the operation handler for the delete config loadbalancer externalipaddress IP address port port protocol proto operation DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler + // DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler sets the operation handler for the delete config loadbalancer hosturl hosturl externalipaddress IP address port port protocol proto operation + DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler // DeleteConfigLoadbalancerNameLbNameHandler sets the operation handler for the delete config loadbalancer name lb name operation DeleteConfigLoadbalancerNameLbNameHandler DeleteConfigLoadbalancerNameLbNameHandler - // DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler sets the operation handler for the delete config loadbalancer urlpath urlpath externalipaddress IP address port port protocol proto operation - DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler // DeleteConfigMirrorIdentIdentHandler sets the operation handler for the delete config mirror ident ident operation DeleteConfigMirrorIdentIdentHandler DeleteConfigMirrorIdentIdentHandler // DeleteConfigNeighborIPAddressDevIfNameHandler sets the operation handler for the delete config neighbor IP address dev if name operation @@ -543,12 +543,12 @@ func (o *LoxilbRestAPIAPI) Validate() error { if o.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler == nil { unregistered = append(unregistered, "DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler") } + if o.DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler == nil { + unregistered = append(unregistered, "DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler") + } if o.DeleteConfigLoadbalancerNameLbNameHandler == nil { unregistered = append(unregistered, "DeleteConfigLoadbalancerNameLbNameHandler") } - if o.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler == nil { - unregistered = append(unregistered, "DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler") - } if o.DeleteConfigMirrorIdentIdentHandler == nil { unregistered = append(unregistered, "DeleteConfigMirrorIdentIdentHandler") } @@ -858,11 +858,11 @@ func (o *LoxilbRestAPIAPI) initHandlerCache() { if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } - o.handlers["DELETE"]["/config/loadbalancer/name/{lb_name}"] = NewDeleteConfigLoadbalancerNameLbName(o.context, o.DeleteConfigLoadbalancerNameLbNameHandler) + o.handlers["DELETE"]["/config/loadbalancer/hosturl/{hosturl}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}"] = NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto(o.context, o.DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } - o.handlers["DELETE"]["/config/loadbalancer/urlpath/{urlpath}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}"] = NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto(o.context, o.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler) + o.handlers["DELETE"]["/config/loadbalancer/name/{lb_name}"] = NewDeleteConfigLoadbalancerNameLbName(o.context, o.DeleteConfigLoadbalancerNameLbNameHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } diff --git a/common/common.go b/common/common.go index 314875591..b3568bea9 100644 --- a/common/common.go +++ b/common/common.go @@ -573,8 +573,8 @@ type LbServiceArg struct { PersistTimeout uint32 `json:"persistTimeout"` // Snat - Do SNAT Snat bool `json:"snat"` - // Path - Ingress Specific URL path - Path string `json:"path"` + // HostUrl - Ingress Specific URL path + HostUrl string `json:"path"` } // LbEndPointArg - Information related to load-balancer end-point diff --git a/loxilb-ebpf b/loxilb-ebpf index d34f73f20..5cf05d5cf 160000 --- a/loxilb-ebpf +++ b/loxilb-ebpf @@ -1 +1 @@ -Subproject commit d34f73f20de8e062ab5a4af720da8b1f9637d11e +Subproject commit 5cf05d5cf1101a75933169fa4ca553e0ed8b8161 diff --git a/pkg/loxinet/dpbroker.go b/pkg/loxinet/dpbroker.go index c30f3294a..e2f7c31be 100644 --- a/pkg/loxinet/dpbroker.go +++ b/pkg/loxinet/dpbroker.go @@ -286,7 +286,8 @@ type NatDpWorkQ struct { BlockNum uint16 DsrMode bool CsumDis bool - TermHTTPs bool + TermHTTPS bool + HostURL string Proto uint8 Mark int NatType NatT diff --git a/pkg/loxinet/dpebpf_linux.go b/pkg/loxinet/dpebpf_linux.go index 4fe84e699..1cbd9a20a 100644 --- a/pkg/loxinet/dpebpf_linux.go +++ b/pkg/loxinet/dpebpf_linux.go @@ -129,7 +129,7 @@ type ( rtDat C.struct_dp_rt_tact rtL3NhAct C.struct_dp_rt_nh_act natKey C.struct_dp_nat_key - natActs C.struct_dp_nat_tacts + proxyActs C.struct_dp_proxy_tacts nxfrmAct C.struct_mf_xfrm_inf sess4Key C.struct_dp_sess4_key sessAct C.struct_dp_sess_tact @@ -953,98 +953,101 @@ func DpNatLbRuleMod(w *NatDpWorkQ) int { key.zone = C.ushort(w.ZoneNum) } - if w.Work == DpCreate { - dat := new(natActs) - C.memset(unsafe.Pointer(dat), 0, C.sizeof_struct_dp_nat_tacts) - if w.NatType == DpSnat { - dat.ca.act_type = C.DP_SET_SNAT - } else if w.NatType == DpDnat || w.NatType == DpFullNat { - dat.ca.act_type = C.DP_SET_DNAT - } else if w.NatType == DpFullProxy { - dat.ca.act_type = C.DP_SET_FULLPROXY - } else { - tk.LogIt(tk.LogDebug, "[DP] LB rule %s add[NOK] - EbpfErrNat4Add\n", w.ServiceIP.String()) - return EbpfErrNat4Add - } - - // seconds to nanoseconds - dat.ito = C.uint64_t(w.InActTo * 1000000000) - dat.pto = C.uint64_t(w.PersistTo * 1000000000) - dat.base_to = 0 + dat := new(proxyActs) + C.memset(unsafe.Pointer(dat), 0, C.sizeof_struct_dp_proxy_tacts) + if w.NatType == DpSnat { + dat.ca.act_type = C.DP_SET_SNAT + } else if w.NatType == DpDnat || w.NatType == DpFullNat { + dat.ca.act_type = C.DP_SET_DNAT + } else if w.NatType == DpFullProxy { + dat.ca.act_type = C.DP_SET_FULLPROXY + } else { + tk.LogIt(tk.LogDebug, "[DP] LB rule %s add[NOK] - EbpfErrNat4Add\n", w.ServiceIP.String()) + return EbpfErrNat4Add + } - /*dat.npmhh = 2 - dat.pmhh[0] = 0x64646464 - dat.pmhh[1] = 0x65656565*/ - for i, k := range w.secIP { - dat.pmhh[i] = C.uint(tk.IPtonl(k)) - } - dat.npmhh = C.uchar(len(w.secIP)) + // seconds to nanoseconds + dat.ito = C.uint64_t(w.InActTo * 1000000000) + dat.pto = C.uint64_t(w.PersistTo * 1000000000) + dat.base_to = 0 - switch { - case w.EpSel == EpRR: - dat.sel_type = C.NAT_LB_SEL_RR - case w.EpSel == EpHash: - dat.sel_type = C.NAT_LB_SEL_HASH - case w.EpSel == EpRRPersist: - dat.sel_type = C.NAT_LB_SEL_RR_PERSIST - case w.EpSel == EpLeastConn: - dat.sel_type = C.NAT_LB_SEL_LC - case w.EpSel == EpN2: - dat.sel_type = C.NAT_LB_SEL_N2 - /* Currently not implemented in DP */ - /*case w.EpSel == EP_PRIO: - dat.sel_type = C.NAT_LB_SEL_PRIO*/ - default: - dat.sel_type = C.NAT_LB_SEL_RR - } - dat.ca.cidx = C.uint(w.Mark) - if w.DsrMode { - dat.ca.oaux = 1 - } + /*dat.npmhh = 2 + dat.pmhh[0] = 0x64646464 + dat.pmhh[1] = 0x65656565*/ + for i, k := range w.secIP { + dat.pmhh[i] = C.uint(tk.IPtonl(k)) + } + dat.npmhh = C.uchar(len(w.secIP)) - nxfa := (*nxfrmAct)(unsafe.Pointer(&dat.nxfrms[0])) + switch { + case w.EpSel == EpRR: + dat.sel_type = C.NAT_LB_SEL_RR + case w.EpSel == EpHash: + dat.sel_type = C.NAT_LB_SEL_HASH + case w.EpSel == EpRRPersist: + dat.sel_type = C.NAT_LB_SEL_RR_PERSIST + case w.EpSel == EpLeastConn: + dat.sel_type = C.NAT_LB_SEL_LC + case w.EpSel == EpN2: + dat.sel_type = C.NAT_LB_SEL_N2 + /* Currently not implemented in DP */ + /*case w.EpSel == EP_PRIO: + dat.sel_type = C.NAT_LB_SEL_PRIO*/ + default: + dat.sel_type = C.NAT_LB_SEL_RR + } + dat.ca.cidx = C.uint(w.Mark) + if w.DsrMode { + dat.ca.oaux = 1 + } - for _, k := range w.endPoints { - nxfa.wprio = C.uchar(k.Weight) - nxfa.nat_xport = C.ushort(tk.Htons(k.XPort)) - if tk.IsNetIPv6(k.XIP.String()) { - convNetIP2DPv6Addr(unsafe.Pointer(&nxfa.nat_xip[0]), k.XIP) + nxfa := (*nxfrmAct)(unsafe.Pointer(&dat.nxfrms[0])) - if tk.IsNetIPv6(k.RIP.String()) { - convNetIP2DPv6Addr(unsafe.Pointer(&nxfa.nat_rip[0]), k.RIP) - } - nxfa.nv6 = 1 - } else { - nxfa.nat_xip[0] = C.uint(tk.IPtonl(k.XIP)) - nxfa.nat_rip[0] = C.uint(tk.IPtonl(k.RIP)) - nxfa.nv6 = 0 - } + for _, k := range w.endPoints { + nxfa.wprio = C.uchar(k.Weight) + nxfa.nat_xport = C.ushort(tk.Htons(k.XPort)) + if tk.IsNetIPv6(k.XIP.String()) { + convNetIP2DPv6Addr(unsafe.Pointer(&nxfa.nat_xip[0]), k.XIP) - if k.InActive { - nxfa.inactive = 1 + if tk.IsNetIPv6(k.RIP.String()) { + convNetIP2DPv6Addr(unsafe.Pointer(&nxfa.nat_rip[0]), k.RIP) } - - nxfa = (*nxfrmAct)(getPtrOffset(unsafe.Pointer(nxfa), - C.sizeof_struct_mf_xfrm_inf)) + nxfa.nv6 = 1 + } else { + nxfa.nat_xip[0] = C.uint(tk.IPtonl(k.XIP)) + nxfa.nat_rip[0] = C.uint(tk.IPtonl(k.RIP)) + nxfa.nv6 = 0 } - // Any unused end-points should be marked inactive - for i := len(w.endPoints); i < C.LLB_MAX_NXFRMS; i++ { - nxfa := (*nxfrmAct)(unsafe.Pointer(&dat.nxfrms[i])) + if k.InActive { nxfa.inactive = 1 } - dat.nxfrm = C.ushort(len(w.endPoints)) - if w.CsumDis { - dat.cdis = 1 - } else { - dat.cdis = 0 - } + nxfa = (*nxfrmAct)(getPtrOffset(unsafe.Pointer(nxfa), + C.sizeof_struct_mf_xfrm_inf)) + } - if w.TermHTTPs { - dat.sec_mode = C.SEC_MODE_HTTPS - } + // Any unused end-points should be marked inactive + for i := len(w.endPoints); i < C.LLB_MAX_NXFRMS; i++ { + nxfa := (*nxfrmAct)(unsafe.Pointer(&dat.nxfrms[i])) + nxfa.inactive = 1 + } + dat.nxfrm = C.ushort(len(w.endPoints)) + if w.CsumDis { + dat.cdis = 1 + } else { + dat.cdis = 0 + } + + if w.TermHTTPS { + dat.sec_mode = C.SEC_MODE_HTTPS + } + + hostURLStr := C.CString(w.HostURL) + C.memcpy(unsafe.Pointer(&dat.host_url[0]), unsafe.Pointer(hostURLStr), C.ulong(len(w.HostURL))+1) + + if w.Work == DpCreate { ret := C.llb_add_map_elem(C.LL_DP_NAT_MAP, unsafe.Pointer(key), unsafe.Pointer(dat)) @@ -1056,7 +1059,9 @@ func DpNatLbRuleMod(w *NatDpWorkQ) int { tk.LogIt(tk.LogDebug, "[DP] LB rule %s add[OK]\n", w.ServiceIP.String()) return 0 } else if w.Work == DpRemove { - C.llb_del_map_elem(C.LL_DP_NAT_MAP, unsafe.Pointer(key)) + C.llb_del_map_elem_wval(C.LL_DP_NAT_MAP, + unsafe.Pointer(key), + unsafe.Pointer(dat)) return 0 } diff --git a/pkg/loxinet/rules.go b/pkg/loxinet/rules.go index a20a45f07..072cc0fc1 100644 --- a/pkg/loxinet/rules.go +++ b/pkg/loxinet/rules.go @@ -792,7 +792,7 @@ func (R *RuleH) GetNatLbRule() ([]cmn.LbRuleMod, error) { ret.Serv.ProbeReq = data.hChk.prbReq ret.Serv.ProbeResp = data.hChk.prbResp ret.Serv.Name = data.name - ret.Serv.Path = data.tuples.path + ret.Serv.HostUrl = data.tuples.path if data.act.actType == RtActSnat { ret.Serv.Snat = true } @@ -950,7 +950,7 @@ func (R *RuleH) GetNatLbRuleByServArgs(serv cmn.LbServiceArg) *ruleEnt { l4prot := rule8Tuple{ipProto, 0xff} l3dst := ruleIPTuple{*sNetAddr} l4dst := rule16Tuple{serv.ServPort, 0xffff} - rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.Path} + rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.HostUrl} return R.tables[RtLB].eMap[rt.ruleKey()] } @@ -978,7 +978,7 @@ func (R *RuleH) GetNatLbRuleSecIPs(serv cmn.LbServiceArg) []string { l4prot := rule8Tuple{ipProto, 0xff} l3dst := ruleIPTuple{*sNetAddr} l4dst := rule16Tuple{serv.ServPort, 0xffff} - rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.Path} + rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.HostUrl} if R.tables[RtLB].eMap[rt.ruleKey()] != nil { for _, ip := range R.tables[RtLB].eMap[rt.ruleKey()].secIP { ips = append(ips, ip.sIP.String()) @@ -1499,7 +1499,7 @@ func (R *RuleH) AddNatLbRule(serv cmn.LbServiceArg, servSecIPs []cmn.LbSecIPArg, l4prot := rule8Tuple{ipProto, 0xff} l3dst := ruleIPTuple{*sNetAddr} l4dst := rule16Tuple{serv.ServPort, 0xffff} - rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.Path} + rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.HostUrl} eRule := R.tables[RtLB].eMap[rt.ruleKey()] @@ -1710,7 +1710,7 @@ func (R *RuleH) DeleteNatLbRule(serv cmn.LbServiceArg) (int, error) { l4prot := rule8Tuple{ipProto, 0xff} l3dst := ruleIPTuple{*sNetAddr} l4dst := rule16Tuple{serv.ServPort, 0xffff} - rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.Path} + rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.HostUrl} rule := R.tables[RtLB].eMap[rt.ruleKey()] if rule == nil { @@ -2583,7 +2583,7 @@ func (r *ruleEnt) Nat2DP(work DpWorkT) int { nWork.Status = &r.sync nWork.ZoneNum = r.zone.ZoneNum if r.secMode == cmn.LBServHttps { - nWork.TermHTTPs = true + nWork.TermHTTPS = true } nWork.ServiceIP = r.tuples.l3Dst.addr.IP.Mask(r.tuples.l3Dst.addr.Mask) nWork.L4Port = r.tuples.l4Dst.val @@ -2592,6 +2592,7 @@ func (r *ruleEnt) Nat2DP(work DpWorkT) int { nWork.BlockNum = r.tuples.pref nWork.InActTo = uint64(r.iTO) nWork.PersistTo = uint64(r.pTO) + nWork.HostURL = r.tuples.path if r.act.actType == RtActDnat { nWork.NatType = DpDnat From cc4e57287c14b14edb00b3bd2b4898a1133120ab Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Fri, 19 Jul 2024 12:25:30 +0900 Subject: [PATCH 2/5] gh-726 Initial support for basic ingress support (w/HTTPS) based on http host header --- ...ess_ip_address_port_port_protocol_proto.go | 58 +++ ...ess_port_port_protocol_proto_parameters.go | 216 +++++++++++ ...ress_port_port_protocol_proto_responses.go | 354 ++++++++++++++++++ ...ess_port_port_protocol_proto_urlbuilder.go | 148 ++++++++ 4 files changed, 776 insertions(+) create mode 100644 api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto.go create mode 100644 api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_parameters.go create mode 100644 api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_responses.go create mode 100644 api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_urlbuilder.go diff --git a/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto.go b/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto.go new file mode 100644 index 000000000..d8f7773b1 --- /dev/null +++ b/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" +) + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc turns a function with the right signature into a delete config loadbalancer hosturl hosturl externalipaddress IP address port port protocol proto handler +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc func(DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc) Handle(params DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder { + return fn(params) +} + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler interface for that can handle valid delete config loadbalancer hosturl hosturl externalipaddress IP address port port protocol proto params +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler interface { + Handle(DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder +} + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto creates a new http.Handler for the delete config loadbalancer hosturl hosturl externalipaddress IP address port port protocol proto operation +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto(ctx *middleware.Context, handler DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler) *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto { + return &DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto{Context: ctx, Handler: handler} +} + +/* + DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto swagger:route DELETE /config/loadbalancer/hosturl/{hosturl}/externalipaddress/{ip_address}/port/{port}/protocol/{proto} deleteConfigLoadbalancerHosturlHosturlExternalipaddressIpAddressPortPortProtocolProto + +# Delete an existing Load balancer service + +Delete an existing load balancer service with . +*/ +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto struct { + Context *middleware.Context + Handler DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoHandler +} + +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams() + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_parameters.go b/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_parameters.go new file mode 100644 index 000000000..4caef334e --- /dev/null +++ b/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_parameters.go @@ -0,0 +1,216 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams creates a new DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams object +// +// There are no default values defined in the spec. +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams() DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams { + + return DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams{} +} + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams contains all the bound params for the delete config loadbalancer hosturl hosturl externalipaddress IP address port port protocol proto operation +// typically these are obtained from a http.Request +// +// swagger:parameters DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProto +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*option for BGP enable + In: query + */ + Bgp *bool + /*block value if any + In: query + */ + Block *float64 + /*Attributes for load balance service + Required: true + In: path + */ + Hosturl string + /*Attributes for load balance service + Required: true + In: path + */ + IPAddress string + /*Attributes for load balance service + Required: true + In: path + */ + Port float64 + /*Attributes for load balance service + Required: true + In: path + */ + Proto string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams() beforehand. +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + qs := runtime.Values(r.URL.Query()) + + qBgp, qhkBgp, _ := qs.GetOK("bgp") + if err := o.bindBgp(qBgp, qhkBgp, route.Formats); err != nil { + res = append(res, err) + } + + qBlock, qhkBlock, _ := qs.GetOK("block") + if err := o.bindBlock(qBlock, qhkBlock, route.Formats); err != nil { + res = append(res, err) + } + + rHosturl, rhkHosturl, _ := route.Params.GetOK("hosturl") + if err := o.bindHosturl(rHosturl, rhkHosturl, route.Formats); err != nil { + res = append(res, err) + } + + rIPAddress, rhkIPAddress, _ := route.Params.GetOK("ip_address") + if err := o.bindIPAddress(rIPAddress, rhkIPAddress, route.Formats); err != nil { + res = append(res, err) + } + + rPort, rhkPort, _ := route.Params.GetOK("port") + if err := o.bindPort(rPort, rhkPort, route.Formats); err != nil { + res = append(res, err) + } + + rProto, rhkProto, _ := route.Params.GetOK("proto") + if err := o.bindProto(rProto, rhkProto, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindBgp binds and validates parameter Bgp from query. +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) bindBgp(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertBool(raw) + if err != nil { + return errors.InvalidType("bgp", "query", "bool", raw) + } + o.Bgp = &value + + return nil +} + +// bindBlock binds and validates parameter Block from query. +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) bindBlock(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertFloat64(raw) + if err != nil { + return errors.InvalidType("block", "query", "float64", raw) + } + o.Block = &value + + return nil +} + +// bindHosturl binds and validates parameter Hosturl from path. +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) bindHosturl(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Hosturl = raw + + return nil +} + +// bindIPAddress binds and validates parameter IPAddress from path. +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) bindIPAddress(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.IPAddress = raw + + return nil +} + +// bindPort binds and validates parameter Port from path. +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) bindPort(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + + value, err := swag.ConvertFloat64(raw) + if err != nil { + return errors.InvalidType("port", "path", "float64", raw) + } + o.Port = value + + return nil +} + +// bindProto binds and validates parameter Proto from path. +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoParams) bindProto(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Proto = raw + + return nil +} diff --git a/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_responses.go b/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_responses.go new file mode 100644 index 000000000..682cbbf72 --- /dev/null +++ b/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/loxilb-io/loxilb/api/models" +) + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContentCode is the HTTP code returned for type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContent +const DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContentCode int = 204 + +/* +DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContent OK + +swagger:response deleteConfigLoadbalancerHosturlHosturlExternalipaddressIpAddressPortPortProtocolProtoNoContent +*/ +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContent struct { +} + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContent creates DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContent with default headers values +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContent() *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContent { + + return &DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContent{} +} + +// WriteResponse to the client +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(204) +} + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequestCode is the HTTP code returned for type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest +const DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequestCode int = 400 + +/* +DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest Malformed arguments for API call + +swagger:response deleteConfigLoadbalancerHosturlHosturlExternalipaddressIpAddressPortPortProtocolProtoBadRequest +*/ +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest struct { + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest creates DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest with default headers values +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest() *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest { + + return &DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest{} +} + +// WithPayload adds the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto bad request response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto bad request response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(400) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorizedCode is the HTTP code returned for type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized +const DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorizedCode int = 401 + +/* +DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized Invalid authentication credentials + +swagger:response deleteConfigLoadbalancerHosturlHosturlExternalipaddressIpAddressPortPortProtocolProtoUnauthorized +*/ +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized struct { + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized creates DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized with default headers values +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized() *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized { + + return &DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized{} +} + +// WithPayload adds the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto unauthorized response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto unauthorized response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(401) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbiddenCode is the HTTP code returned for type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden +const DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbiddenCode int = 403 + +/* +DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden Capacity insufficient + +swagger:response deleteConfigLoadbalancerHosturlHosturlExternalipaddressIpAddressPortPortProtocolProtoForbidden +*/ +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden struct { + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden creates DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden with default headers values +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden() *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden { + + return &DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden{} +} + +// WithPayload adds the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto forbidden response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto forbidden response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(403) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFoundCode is the HTTP code returned for type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound +const DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFoundCode int = 404 + +/* +DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound Resource not found + +swagger:response deleteConfigLoadbalancerHosturlHosturlExternalipaddressIpAddressPortPortProtocolProtoNotFound +*/ +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound struct { + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound creates DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound with default headers values +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound() *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound { + + return &DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound{} +} + +// WithPayload adds the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto not found response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto not found response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(404) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflictCode is the HTTP code returned for type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict +const DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflictCode int = 409 + +/* +DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict Resource Conflict. VLAN already exists OR dependency VRF/VNET not found + +swagger:response deleteConfigLoadbalancerHosturlHosturlExternalipaddressIpAddressPortPortProtocolProtoConflict +*/ +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict struct { + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict creates DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict with default headers values +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict() *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict { + + return &DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict{} +} + +// WithPayload adds the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto conflict response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto conflict response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(409) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerErrorCode is the HTTP code returned for type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError +const DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerErrorCode int = 500 + +/* +DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError Internal service error + +swagger:response deleteConfigLoadbalancerHosturlHosturlExternalipaddressIpAddressPortPortProtocolProtoInternalServerError +*/ +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError struct { + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError creates DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError with default headers values +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError() *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError { + + return &DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError{} +} + +// WithPayload adds the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto internal server error response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto internal server error response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(500) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailableCode is the HTTP code returned for type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable +const DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailableCode int = 503 + +/* +DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable Maintanence mode + +swagger:response deleteConfigLoadbalancerHosturlHosturlExternalipaddressIpAddressPortPortProtocolProtoServiceUnavailable +*/ +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable struct { + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable creates DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable with default headers values +func NewDeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable() *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable { + + return &DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable{} +} + +// WithPayload adds the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto service unavailable response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable) WithPayload(payload *models.Error) *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the delete config loadbalancer hosturl hosturl externalipaddress Ip address port port protocol proto service unavailable response +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoServiceUnavailable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(503) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_urlbuilder.go b/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_urlbuilder.go new file mode 100644 index 000000000..f6e9f09e3 --- /dev/null +++ b/api/restapi/operations/delete_config_loadbalancer_hosturl_hosturl_externalipaddress_ip_address_port_port_protocol_proto_urlbuilder.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" + + "github.com/go-openapi/swag" +) + +// DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL generates an URL for the delete config loadbalancer hosturl hosturl externalipaddress IP address port port protocol proto operation +type DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL struct { + Hosturl string + IPAddress string + Port float64 + Proto string + + Bgp *bool + Block *float64 + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL) WithBasePath(bp string) *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/config/loadbalancer/hosturl/{hosturl}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}" + + hosturl := o.Hosturl + if hosturl != "" { + _path = strings.Replace(_path, "{hosturl}", hosturl, -1) + } else { + return nil, errors.New("hosturl is required on DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL") + } + + iPAddress := o.IPAddress + if iPAddress != "" { + _path = strings.Replace(_path, "{ip_address}", iPAddress, -1) + } else { + return nil, errors.New("ipAddress is required on DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL") + } + + port := swag.FormatFloat64(o.Port) + if port != "" { + _path = strings.Replace(_path, "{port}", port, -1) + } else { + return nil, errors.New("port is required on DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL") + } + + proto := o.Proto + if proto != "" { + _path = strings.Replace(_path, "{proto}", proto, -1) + } else { + return nil, errors.New("proto is required on DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/netlox/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + qs := make(url.Values) + + var bgpQ string + if o.Bgp != nil { + bgpQ = swag.FormatBool(*o.Bgp) + } + if bgpQ != "" { + qs.Set("bgp", bgpQ) + } + + var blockQ string + if o.Block != nil { + blockQ = swag.FormatFloat64(*o.Block) + } + if blockQ != "" { + qs.Set("block", blockQ) + } + + _result.RawQuery = qs.Encode() + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *DeleteConfigLoadbalancerHosturlHosturlExternalipaddressIPAddressPortPortProtocolProtoURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} From c2e44f94b139ad471cb3144387abd1615d51ae78 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Fri, 19 Jul 2024 12:25:58 +0900 Subject: [PATCH 3/5] gh-726 Initial support for basic ingress support (w/HTTPS) based on http host header --- api/swagger.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/swagger.yml b/api/swagger.yml index 6d98815dd..f154fb4f8 100644 --- a/api/swagger.yml +++ b/api/swagger.yml @@ -234,12 +234,12 @@ paths: description: Maintanence mode schema: $ref: '#/definitions/Error' - '/config/loadbalancer/urlpath/{urlpath}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}': + '/config/loadbalancer/hosturl/{hosturl}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}': delete: summary: Delete an existing Load balancer service description: Delete an existing load balancer service with . parameters: - - name: urlpath + - name: hosturl in: path type: string required: true @@ -2966,9 +2966,9 @@ definitions: type: integer format: int32 description: end-point specific op (0-create, 1-attachEP, 2-detachEP) - path: + host: type: string - description: Ingress specific URL path + description: Ingress specific host URL path endpoints: type: array From 9c4eb567156424eadc84b57df03473663a3fdb19 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Fri, 19 Jul 2024 13:43:16 +0900 Subject: [PATCH 4/5] gh-726 Initial support for basic ingress support (w/HTTPS) based on http host header --- loxilb-ebpf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loxilb-ebpf b/loxilb-ebpf index 5cf05d5cf..36b8a9b09 160000 --- a/loxilb-ebpf +++ b/loxilb-ebpf @@ -1 +1 @@ -Subproject commit 5cf05d5cf1101a75933169fa4ca553e0ed8b8161 +Subproject commit 36b8a9b09479782aee7733497c3e2b37db834f72 From 542bb551a63e48867bfdebca7676bd6c0ae3cb6c Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Fri, 19 Jul 2024 14:12:22 +0900 Subject: [PATCH 5/5] gh-726 Initial support for basic ingress support (w/HTTPS) based on http host header --- loxilb-ebpf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loxilb-ebpf b/loxilb-ebpf index 36b8a9b09..a89b92b2e 160000 --- a/loxilb-ebpf +++ b/loxilb-ebpf @@ -1 +1 @@ -Subproject commit 36b8a9b09479782aee7733497c3e2b37db834f72 +Subproject commit a89b92b2e05ac623161b1e18cb7e6153d95c2dd2