Skip to content

Commit 4d71adf

Browse files
committed
MINOR: configuration: add support for quic-initial resource
1 parent 8068be4 commit 4d71adf

7 files changed

Lines changed: 417 additions & 0 deletions

File tree

.aspell.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ allowed:
2828
- linters
2929
- govulncheck
3030
- dataplaneapi
31+
- quic

configure_data_plane.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,21 @@ func configureAPI(api *operations.DataPlaneAPI) http.Handler { //nolint:cyclop,m
556556
api.TCPCheckReplaceTCPCheckDefaultsHandler = &handlers.ReplaceTCPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra}
557557
api.TCPCheckReplaceAllTCPCheckDefaultsHandler = &handlers.ReplaceAllTCPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra}
558558

559+
// setup quic initia; rule handlers
560+
api.QUICInitialRuleCreateQUICInitialRuleDefaultsHandler = &handlers.CreateQUICInitialRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra}
561+
api.QUICInitialRuleDeleteQUICInitialRuleDefaultsHandler = &handlers.DeleteQUICInitialRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra}
562+
api.QUICInitialRuleGetQUICInitialRuleDefaultsHandler = &handlers.GetQUICInitialRuleDefaultsHandlerImpl{Client: client}
563+
api.QUICInitialRuleGetAllQUICInitialRuleDefaultsHandler = &handlers.GetAllQUICInitialRuleDefaultsHandlerImpl{Client: client}
564+
api.QUICInitialRuleReplaceQUICInitialRuleDefaultsHandler = &handlers.ReplaceQUICInitialRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra}
565+
api.QUICInitialRuleReplaceAllQUICInitialRuleDefaultsHandler = &handlers.ReplaceAllQUICInitialRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra}
566+
567+
api.QUICInitialRuleCreateQUICInitialRuleFrontendHandler = &handlers.CreateQUICInitialRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra}
568+
api.QUICInitialRuleDeleteQUICInitialRuleFrontendHandler = &handlers.DeleteQUICInitialRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra}
569+
api.QUICInitialRuleGetQUICInitialRuleFrontendHandler = &handlers.GetQUICInitialRuleFrontendHandlerImpl{Client: client}
570+
api.QUICInitialRuleGetAllQUICInitialRuleFrontendHandler = &handlers.GetAllQUICInitialRuleFrontendHandlerImpl{Client: client}
571+
api.QUICInitialRuleReplaceQUICInitialRuleFrontendHandler = &handlers.ReplaceQUICInitialRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra}
572+
api.QUICInitialRuleReplaceAllQUICInitialRuleFrontendHandler = &handlers.ReplaceAllQUICInitialRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra}
573+
559574
// setup declare capture handlers
560575
api.DeclareCaptureCreateDeclareCaptureHandler = &handlers.CreateDeclareCaptureHandlerImpl{Client: client, ReloadAgent: ra}
561576
api.DeclareCaptureDeleteDeclareCaptureHandler = &handlers.DeleteDeclareCaptureHandlerImpl{Client: client, ReloadAgent: ra}

generate/parents/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func main() {
4141
cnparents.TCPCheckChildType,
4242
cnparents.TCPRequestRuleChildType,
4343
cnparents.TCPResponseRuleChildType,
44+
cnparents.QUICInitialRuleType,
4445
cnparents.ACLChildType,
4546
cnparents.BindChildType,
4647
cnparents.FilterChildType,
@@ -76,6 +77,9 @@ type TmplData struct {
7677
}
7778

7879
func generateAlias(childType string) bytes.Buffer {
80+
// Initialisms used in child resources need to be added here for the generated parent functions to match with the operations params
81+
swag.AddInitialisms("QUIC")
82+
7983
funcMap := template.FuncMap{
8084
"parents": cnparents.Parents,
8185
}

generate/parents/operations.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ func operations(childType string) []string {
9999
"Replace",
100100
"ReplaceAll",
101101
}
102+
case cnparents.QUICInitialRuleType:
103+
return []string{
104+
"Create",
105+
"Get",
106+
"GetAll",
107+
"Delete",
108+
"Replace",
109+
"ReplaceAll",
110+
}
102111
case cnparents.ACLChildType:
103112
return []string{
104113
"Create",

generate/swagger/script.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ swagger generate server -f $SPEC_DIR/haproxy_spec.yaml \
6666
--skip-models \
6767
-s dataplaneapi \
6868
--additional-initialism=FCGI \
69+
--additional-initialism=QUIC \
6970
--tags=Discovery \
7071
--tags=ServiceDiscovery \
7172
--tags=Information \
@@ -125,6 +126,7 @@ swagger generate server -f $SPEC_DIR/haproxy_spec.yaml \
125126
--tags=Table \
126127
--tags=CrtStore \
127128
--tags=CrtLoad \
129+
--tags=QUICInitialRule \
128130
-r $SPEC_DIR/copyright.txt \
129131
--template-dir generate/swagger/templates
130132

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// Copyright 2019 HAProxy Technologies
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
package handlers
15+
16+
import (
17+
"github.com/go-openapi/runtime/middleware"
18+
19+
cnconstants "github.com/haproxytech/client-native/v6/configuration/parents"
20+
"github.com/haproxytech/dataplaneapi/operations/quic_initial_rule"
21+
)
22+
23+
type (
24+
CreateQUICInitialRuleFrontendHandlerImpl CreateQUICInitialRuleHandlerImpl
25+
CreateQUICInitialRuleDefaultsHandlerImpl CreateQUICInitialRuleHandlerImpl
26+
)
27+
28+
type (
29+
GetQUICInitialRuleFrontendHandlerImpl GetQUICInitialRuleHandlerImpl
30+
GetQUICInitialRuleDefaultsHandlerImpl GetQUICInitialRuleHandlerImpl
31+
)
32+
33+
type (
34+
GetAllQUICInitialRuleFrontendHandlerImpl GetAllQUICInitialRuleHandlerImpl
35+
GetAllQUICInitialRuleDefaultsHandlerImpl GetAllQUICInitialRuleHandlerImpl
36+
)
37+
38+
type (
39+
DeleteQUICInitialRuleFrontendHandlerImpl DeleteQUICInitialRuleHandlerImpl
40+
DeleteQUICInitialRuleDefaultsHandlerImpl DeleteQUICInitialRuleHandlerImpl
41+
)
42+
43+
type (
44+
ReplaceQUICInitialRuleFrontendHandlerImpl ReplaceQUICInitialRuleHandlerImpl
45+
ReplaceQUICInitialRuleDefaultsHandlerImpl ReplaceQUICInitialRuleHandlerImpl
46+
)
47+
48+
type (
49+
ReplaceAllQUICInitialRuleFrontendHandlerImpl ReplaceAllQUICInitialRuleHandlerImpl
50+
ReplaceAllQUICInitialRuleDefaultsHandlerImpl ReplaceAllQUICInitialRuleHandlerImpl
51+
)
52+
53+
func (h *CreateQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.CreateQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder {
54+
g := CreateQUICInitialRuleHandlerImpl(*h)
55+
return g.Handle(cnconstants.FrontendParentType, params, principal)
56+
}
57+
58+
func (h *CreateQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.CreateQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder {
59+
g := CreateQUICInitialRuleHandlerImpl(*h)
60+
pg := quic_initial_rule.CreateQUICInitialRuleFrontendParams(params)
61+
return g.Handle(cnconstants.DefaultsParentType, pg, principal)
62+
}
63+
64+
func (h *GetQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.GetQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder {
65+
g := GetQUICInitialRuleHandlerImpl(*h)
66+
return g.Handle(cnconstants.FrontendParentType, params, principal)
67+
}
68+
69+
func (h *GetQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.GetQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder {
70+
g := GetQUICInitialRuleHandlerImpl(*h)
71+
pg := quic_initial_rule.GetQUICInitialRuleFrontendParams(params)
72+
return g.Handle(cnconstants.DefaultsParentType, pg, principal)
73+
}
74+
75+
func (h *GetAllQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.GetAllQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder {
76+
g := GetAllQUICInitialRuleHandlerImpl(*h)
77+
return g.Handle(cnconstants.FrontendParentType, params, principal)
78+
}
79+
80+
func (h *GetAllQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.GetAllQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder {
81+
g := GetAllQUICInitialRuleHandlerImpl(*h)
82+
pg := quic_initial_rule.GetAllQUICInitialRuleFrontendParams(params)
83+
return g.Handle(cnconstants.DefaultsParentType, pg, principal)
84+
}
85+
86+
func (h *DeleteQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.DeleteQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder {
87+
g := DeleteQUICInitialRuleHandlerImpl(*h)
88+
return g.Handle(cnconstants.FrontendParentType, params, principal)
89+
}
90+
91+
func (h *DeleteQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.DeleteQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder {
92+
g := DeleteQUICInitialRuleHandlerImpl(*h)
93+
pg := quic_initial_rule.DeleteQUICInitialRuleFrontendParams(params)
94+
return g.Handle(cnconstants.DefaultsParentType, pg, principal)
95+
}
96+
97+
func (h *ReplaceQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.ReplaceQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder {
98+
g := ReplaceQUICInitialRuleHandlerImpl(*h)
99+
return g.Handle(cnconstants.FrontendParentType, params, principal)
100+
}
101+
102+
func (h *ReplaceQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.ReplaceQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder {
103+
g := ReplaceQUICInitialRuleHandlerImpl(*h)
104+
pg := quic_initial_rule.ReplaceQUICInitialRuleFrontendParams(params)
105+
return g.Handle(cnconstants.DefaultsParentType, pg, principal)
106+
}
107+
108+
func (h *ReplaceAllQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.ReplaceAllQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder {
109+
g := ReplaceAllQUICInitialRuleHandlerImpl(*h)
110+
return g.Handle(cnconstants.FrontendParentType, params, principal)
111+
}
112+
113+
func (h *ReplaceAllQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.ReplaceAllQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder {
114+
g := ReplaceAllQUICInitialRuleHandlerImpl(*h)
115+
pg := quic_initial_rule.ReplaceAllQUICInitialRuleFrontendParams(params)
116+
return g.Handle(cnconstants.DefaultsParentType, pg, principal)
117+
}

0 commit comments

Comments
 (0)