Skip to content

Commit 4ce8d44

Browse files
committedDec 18, 2024
fix: some lint errors
1 parent ecf0c3f commit 4ce8d44

File tree

3 files changed

+70
-69
lines changed

3 files changed

+70
-69
lines changed
 

‎pkg/infra/persistence/variable.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//nolint:dulp
12
package persistence
23

34
import (

‎pkg/infra/persistence/variable_model.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type VariableModel struct {
2121
}
2222

2323
// The TableName method returns the name of the database table that the struct is mapped to.
24-
func (vl *VariableModel) TableName() string {
24+
func (v *VariableModel) TableName() string {
2525
return "variable"
2626
}
2727

‎pkg/server/handler/variable/handler.go

+68-68
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ import (
1414
logutil "kusionstack.io/kusion/pkg/server/util/logging"
1515
)
1616

17-
// @Id createVariable
18-
// @Summary Create variable
19-
// @Description Create a new variable
20-
// @Tags variable
21-
// @Accept json
22-
// @Produce json
23-
// @Param variable body request.CreateVariableSetRequest true "Created variable"
24-
// @Success 200 {object} entity.Variable "Success"
25-
// @Failure 400 {object} error "Bad Request"
26-
// @Failure 401 {object} error "Unauthorized"
27-
// @Failure 429 {object} error "Too Many Requests"
28-
// @Failure 404 {object} error "Not Found"
29-
// @Failure 500 {object} error "Internal Server Error"
30-
// @Router /api/v1/variables [post]
17+
// @Id createVariable
18+
// @Summary Create variable
19+
// @Description Create a new variable
20+
// @Tags variable
21+
// @Accept json
22+
// @Produce json
23+
// @Param variable body request.CreateVariableSetRequest true "Created variable"
24+
// @Success 200 {object} entity.Variable "Success"
25+
// @Failure 400 {object} error "Bad Request"
26+
// @Failure 401 {object} error "Unauthorized"
27+
// @Failure 429 {object} error "Too Many Requests"
28+
// @Failure 404 {object} error "Not Found"
29+
// @Failure 500 {object} error "Internal Server Error"
30+
// @Router /api/v1/variables [post]
3131
func (h *Handler) CreateVariable() http.HandlerFunc {
3232
return func(w http.ResponseWriter, r *http.Request) {
3333
// Getting stuff from context.
@@ -48,19 +48,19 @@ func (h *Handler) CreateVariable() http.HandlerFunc {
4848
}
4949
}
5050

51-
// @Id deleteVariable
52-
// @Summary Delete variable
53-
// @Description Delete a specified variable with fqn
54-
// @Tags variable
55-
// @Produce json
56-
// @Param fqn path string true "Variable Fqn"
57-
// @Success 200 {object} string "Success"
58-
// @Failure 400 {object} error "Bad Request"
59-
// @Failure 401 {object} error "Unauthorized"
60-
// @Failure 429 {object} error "Too Many Requests"
61-
// @Failure 404 {object} error "Not Found"
62-
// @Failure 500 {object} error "Internal Server Error"
63-
// @Router /api/v1/variables/{fqn} [delete]
51+
// @Id deleteVariable
52+
// @Summary Delete variable
53+
// @Description Delete a specified variable with fqn
54+
// @Tags variable
55+
// @Produce json
56+
// @Param fqn path string true "Variable Fqn"
57+
// @Success 200 {object} string "Success"
58+
// @Failure 400 {object} error "Bad Request"
59+
// @Failure 401 {object} error "Unauthorized"
60+
// @Failure 429 {object} error "Too Many Requests"
61+
// @Failure 404 {object} error "Not Found"
62+
// @Failure 500 {object} error "Internal Server Error"
63+
// @Router /api/v1/variables/{fqn} [delete]
6464
func (h *Handler) DeleteVariable() http.HandlerFunc {
6565
return func(w http.ResponseWriter, r *http.Request) {
6666
// Getting stuff from context.
@@ -76,21 +76,21 @@ func (h *Handler) DeleteVariable() http.HandlerFunc {
7676
}
7777
}
7878

79-
// @Id updateVariable
80-
// @Summary Update variable
81-
// @Description Update the specified variable
82-
// @Tags variable
83-
// @Accept json
84-
// @Produce json
85-
// @Param fqn path string true "Variable Fqn"
86-
// @Param variable body request.UpdateVariableRequest true "Updated Variable"
87-
// @Success 200 {object} entity.Variable "Success"
88-
// @Failure 400 {object} error "Bad Request"
89-
// @Failure 401 {object} error "Unauthorized"
90-
// @Failure 429 {object} error "Too Many Requests"
91-
// @Failure 404 {object} error "Not Found"
92-
// @Failure 500 {object} error "Internal Server Error"
93-
// @Router /api/v1/variables/{fqn} [put]
79+
// @Id updateVariable
80+
// @Summary Update variable
81+
// @Description Update the specified variable
82+
// @Tags variable
83+
// @Accept json
84+
// @Produce json
85+
// @Param fqn path string true "Variable Fqn"
86+
// @Param variable body request.UpdateVariableRequest true "Updated Variable"
87+
// @Success 200 {object} entity.Variable "Success"
88+
// @Failure 400 {object} error "Bad Request"
89+
// @Failure 401 {object} error "Unauthorized"
90+
// @Failure 429 {object} error "Too Many Requests"
91+
// @Failure 404 {object} error "Not Found"
92+
// @Failure 500 {object} error "Internal Server Error"
93+
// @Router /api/v1/variables/{fqn} [put]
9494
func (h *Handler) UpdateVariable() http.HandlerFunc {
9595
return func(w http.ResponseWriter, r *http.Request) {
9696
// Getting stuff from context.
@@ -114,19 +114,19 @@ func (h *Handler) UpdateVariable() http.HandlerFunc {
114114
}
115115
}
116116

117-
// @Id getVariable
118-
// @Summary Get variable
119-
// @Description Get variable by variable fqn
120-
// @Tags variable
121-
// @Produce json
122-
// @Param fqn path string true "Variable Fqn"
123-
// @Success 200 {object} entity.Variable "Success"
124-
// @Failure 400 {object} error "Bad Request"
125-
// @Failure 401 {object} error "Unauthorized"
126-
// @Failure 429 {object} error "Too Many Requests"
127-
// @Failure 404 {object} error "Not Found"
128-
// @Failure 500 {object} error "Internal Server Error"
129-
// @Router /api/v1/variables/{fqn} [get]
117+
// @Id getVariable
118+
// @Summary Get variable
119+
// @Description Get variable by variable fqn
120+
// @Tags variable
121+
// @Produce json
122+
// @Param fqn path string true "Variable Fqn"
123+
// @Success 200 {object} entity.Variable "Success"
124+
// @Failure 400 {object} error "Bad Request"
125+
// @Failure 401 {object} error "Unauthorized"
126+
// @Failure 429 {object} error "Too Many Requests"
127+
// @Failure 404 {object} error "Not Found"
128+
// @Failure 500 {object} error "Internal Server Error"
129+
// @Router /api/v1/variables/{fqn} [get]
130130
func (h *Handler) GetVariable() http.HandlerFunc {
131131
return func(w http.ResponseWriter, r *http.Request) {
132132
// Getting stuff from context.
@@ -142,19 +142,19 @@ func (h *Handler) GetVariable() http.HandlerFunc {
142142
}
143143
}
144144

145-
// @Id listVariables
146-
// @Summary List variables
147-
// @Description List variables
148-
// @Tags variable
149-
// @Produce json
150-
// @Param variable body request.ListVariableSetRequest true "Variable labels to filter variables by."
151-
// @Success 200 {object} entity.VariableLabelsListResult "Success"
152-
// @Failure 400 {object} error "Bad Request"
153-
// @Failure 401 {object} error "Unauthorized"
154-
// @Failure 429 {object} error "Too Many Requests"
155-
// @Failure 404 {object} error "Not Found"
156-
// @Failure 500 {object} error "Internal Server Error"
157-
// @Router /api/v1/variables [get]
145+
// @Id listVariables
146+
// @Summary List variables
147+
// @Description List variables
148+
// @Tags variable
149+
// @Produce json
150+
// @Param variable body request.ListVariableSetRequest true "Variable labels to filter variables by."
151+
// @Success 200 {object} entity.VariableLabelsListResult "Success"
152+
// @Failure 400 {object} error "Bad Request"
153+
// @Failure 401 {object} error "Unauthorized"
154+
// @Failure 429 {object} error "Too Many Requests"
155+
// @Failure 404 {object} error "Not Found"
156+
// @Failure 500 {object} error "Internal Server Error"
157+
// @Router /api/v1/variables [get]
158158
func (h *Handler) ListVariables() http.HandlerFunc {
159159
return func(w http.ResponseWriter, r *http.Request) {
160160
// Getting stuff from context.

0 commit comments

Comments
 (0)