From cee717ffce695d7b25890015071c8adbcd13c83b Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Tue, 16 Jul 2024 00:47:27 +0900 Subject: [PATCH] gh-48 Add support for url-path in LB args --- api/models/loadbalance_entry.go | 3 + api/restapi/configure_loxilb_rest_api.go | 2 +- api/restapi/embedded_spec.go | 162 ++++---- api/restapi/handler/loadbalancer.go | 5 +- ...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 +- api/swagger.yml | 10 +- common/common.go | 2 + pkg/loxinet/rules.go | 26 +- 12 files changed, 916 insertions(+), 90 deletions(-) create mode 100644 api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto.go create mode 100644 api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_parameters.go create mode 100644 api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_externalipaddress_ip_address_port_port_protocol_proto_responses.go create 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 79cb9f189..2921da163 100644 --- a/api/models/loadbalance_entry.go +++ b/api/models/loadbalance_entry.go @@ -336,6 +336,9 @@ 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 df3fd8730..ef93aa4e6 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.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler = operations.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(handler.ConfigDeleteLoadbalancer) + api.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler = operations.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(handler.ConfigDeleteLoadbalancer) api.GetConfigLoadbalancerAllHandler = operations.GetConfigLoadbalancerAllHandlerFunc(handler.ConfigGetLoadbalancer) api.DeleteConfigLoadbalancerAllHandler = operations.DeleteConfigLoadbalancerAllHandlerFunc(handler.ConfigDeleteAllLoadbalancer) api.DeleteConfigLoadbalancerNameLbNameHandler = operations.DeleteConfigLoadbalancerNameLbNameHandlerFunc(handler.ConfigDeleteLoadbalancerByName) diff --git a/api/restapi/embedded_spec.go b/api/restapi/embedded_spec.go index 5c6de6b87..9893bf687 100644 --- a/api/restapi/embedded_spec.go +++ b/api/restapi/embedded_spec.go @@ -2036,43 +2036,17 @@ func init() { } } }, - "/config/loadbalancer/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": "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": { @@ -2124,17 +2098,50 @@ func init() { } } }, - "/config/loadbalancer/name/{lb_name}": { + "/config/loadbalancer/urlpath/{urlpath}/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": "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", + "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": { @@ -4950,6 +4957,10 @@ func init() { "type": "integer", "format": "int32" }, + "path": { + "description": "Ingress specific URL path", + "type": "string" + }, "port": { "description": "port number for the access", "type": "integer" @@ -7644,43 +7655,17 @@ func init() { } } }, - "/config/loadbalancer/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": "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": { @@ -7732,17 +7717,50 @@ func init() { } } }, - "/config/loadbalancer/name/{lb_name}": { + "/config/loadbalancer/urlpath/{urlpath}/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": "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", + "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": { @@ -10987,6 +11005,10 @@ func init() { "type": "integer", "format": "int32" }, + "path": { + "description": "Ingress specific URL path", + "type": "string" + }, "port": { "description": "port number for the access", "type": "integer" @@ -11114,6 +11136,10 @@ 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 c1110b0ae..3abb1f5a5 100644 --- a/api/restapi/handler/loadbalancer.go +++ b/api/restapi/handler/loadbalancer.go @@ -47,6 +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 if lbRules.Serv.Proto == "sctp" { for _, data := range params.Attr.SecondaryIPs { @@ -77,7 +78,7 @@ func ConfigPostLoadbalancer(params operations.PostConfigLoadbalancerParams) midd return &ResultResponse{Result: "Success"} } -func ConfigDeleteLoadbalancer(params operations.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder { +func ConfigDeleteLoadbalancer(params operations.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) 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 @@ -85,6 +86,7 @@ func ConfigDeleteLoadbalancer(params operations.DeleteConfigLoadbalancerExternal lbServ.ServIP = params.IPAddress lbServ.ServPort = uint16(params.Port) lbServ.Proto = params.Proto + lbServ.Path = params.Urlpath if params.Block != nil { lbServ.BlockNum = uint16(*params.Block) } @@ -133,6 +135,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 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 new file mode 100644 index 000000000..7a3bdddf3 --- /dev/null +++ b/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_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" +) + +// 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 new file mode 100644 index 000000000..dcc2939f9 --- /dev/null +++ b/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_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" +) + +// 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 new file mode 100644 index 000000000..7a9fd307f --- /dev/null +++ b/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_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" +) + +// 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 new file mode 100644 index 000000000..aa3a8c5ee --- /dev/null +++ b/api/restapi/operations/delete_config_loadbalancer_urlpath_urlpath_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" +) + +// 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 088e42435..0f79cd5bb 100644 --- a/api/restapi/operations/loxilb_rest_api_api.go +++ b/api/restapi/operations/loxilb_rest_api_api.go @@ -72,12 +72,12 @@ func NewLoxilbRestAPIAPI(spec *loads.Document) *LoxilbRestAPIAPI { DeleteConfigLoadbalancerAllHandler: DeleteConfigLoadbalancerAllHandlerFunc(func(params DeleteConfigLoadbalancerAllParams) middleware.Responder { return middleware.NotImplemented("operation DeleteConfigLoadbalancerAll has not yet been implemented") }), - DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler: DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(func(params DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder { - return middleware.NotImplemented("operation DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProto 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") }), @@ -308,10 +308,10 @@ type LoxilbRestAPIAPI struct { DeleteConfigIpv4addressIPAddressMaskDevIfNameHandler DeleteConfigIpv4addressIPAddressMaskDevIfNameHandler // DeleteConfigLoadbalancerAllHandler sets the operation handler for the delete config loadbalancer all operation DeleteConfigLoadbalancerAllHandler DeleteConfigLoadbalancerAllHandler - // DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler sets the operation handler for the delete config loadbalancer externalipaddress IP address port port protocol proto operation - DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler // 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 @@ -535,12 +535,12 @@ func (o *LoxilbRestAPIAPI) Validate() error { if o.DeleteConfigLoadbalancerAllHandler == nil { unregistered = append(unregistered, "DeleteConfigLoadbalancerAllHandler") } - if o.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler == nil { - unregistered = append(unregistered, "DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler") - } if o.DeleteConfigLoadbalancerNameLbNameHandler == nil { unregistered = append(unregistered, "DeleteConfigLoadbalancerNameLbNameHandler") } + if o.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler == nil { + unregistered = append(unregistered, "DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler") + } if o.DeleteConfigMirrorIdentIdentHandler == nil { unregistered = append(unregistered, "DeleteConfigMirrorIdentIdentHandler") } @@ -846,11 +846,11 @@ func (o *LoxilbRestAPIAPI) initHandlerCache() { if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } - o.handlers["DELETE"]["/config/loadbalancer/externalipaddress/{ip_address}/port/{port}/protocol/{proto}"] = NewDeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProto(o.context, o.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler) + 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) } - o.handlers["DELETE"]["/config/loadbalancer/name/{lb_name}"] = NewDeleteConfigLoadbalancerNameLbName(o.context, o.DeleteConfigLoadbalancerNameLbNameHandler) + o.handlers["DELETE"]["/config/loadbalancer/urlpath/{urlpath}/externalipaddress/{ip_address}/port/{port}/protocol/{proto}"] = NewDeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProto(o.context, o.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } diff --git a/api/swagger.yml b/api/swagger.yml index 4b47fd023..0586f3957 100644 --- a/api/swagger.yml +++ b/api/swagger.yml @@ -174,11 +174,16 @@ paths: description: Maintanence mode schema: $ref: '#/definitions/Error' - '/config/loadbalancer/externalipaddress/{ip_address}/port/{port}/protocol/{proto}': + '/config/loadbalancer/urlpath/{urlpath}/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 + in: path + type: string + required: true + description: Attributes for load balance service - name: ip_address in: path type: string @@ -2901,6 +2906,9 @@ definitions: type: integer format: int32 description: end-point specific op (0-create, 1-attachEP, 2-detachEP) + path: + type: string + description: Ingress specific URL path endpoints: type: array diff --git a/common/common.go b/common/common.go index 687b892e0..314875591 100644 --- a/common/common.go +++ b/common/common.go @@ -573,6 +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"` } // LbEndPointArg - Information related to load-balancer end-point diff --git a/pkg/loxinet/rules.go b/pkg/loxinet/rules.go index 1776cef2a..a20a45f07 100644 --- a/pkg/loxinet/rules.go +++ b/pkg/loxinet/rules.go @@ -155,6 +155,7 @@ type ruleTuples struct { inL4Src rule16Tuple inL4Dst rule16Tuple pref uint16 + path string } type ruleTActType uint @@ -476,9 +477,11 @@ func (r *ruleTuples) ruleMkKeyCompliance(match ruleTMatch) { } func (r *ruleTuples) ruleKey() string { - var ks string - - ks = fmt.Sprintf("%s", r.port.val) + ks := "" + if r.path != "" { + ks += r.path + } + ks += fmt.Sprintf("%s", r.port.val) ks += fmt.Sprintf("%02x:%02x:%02x:%02x:%02x:%02x", r.l2Dst.addr[0]&r.l2Dst.valid[0], r.l2Dst.addr[1]&r.l2Dst.valid[1], @@ -547,10 +550,14 @@ func checkValidMACTuple(mt ruleMacTuple) bool { } func (r *ruleTuples) String() string { - var ks string + + ks := "" + if r.path != "" { + ks += fmt.Sprintf("%s:", r.path) + } if r.port.val != "" { - ks = fmt.Sprintf("inp-%s,", r.port.val) + ks += fmt.Sprintf("inp-%s,", r.port.val) } if checkValidMACTuple(r.l2Dst) { @@ -785,6 +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 if data.act.actType == RtActSnat { ret.Serv.Snat = true } @@ -942,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} + rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.Path} return R.tables[RtLB].eMap[rt.ruleKey()] } @@ -970,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} + rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.Path} if R.tables[RtLB].eMap[rt.ruleKey()] != nil { for _, ip := range R.tables[RtLB].eMap[rt.ruleKey()].secIP { ips = append(ips, ip.sIP.String()) @@ -1491,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} + rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.Path} eRule := R.tables[RtLB].eMap[rt.ruleKey()] @@ -1702,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} + rt := ruleTuples{l3Dst: l3dst, l4Prot: l4prot, l4Dst: l4dst, pref: serv.BlockNum, path: serv.Path} rule := R.tables[RtLB].eMap[rt.ruleKey()] if rule == nil {