Skip to content

Commit 1a9a1ba

Browse files
committedDec 18, 2024
fix: gofumpt handler comments
1 parent f8786d1 commit 1a9a1ba

File tree

6 files changed

+383
-383
lines changed

6 files changed

+383
-383
lines changed
 

‎pkg/server/handler/module/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 createModule
18-
// @Summary Create module
19-
// @Description Create a new Kusion module
20-
// @Tags module
21-
// @Accept json
22-
// @Produce json
23-
// @Param module body request.CreateModuleRequest true "Created module"
24-
// @Success 200 {object} entity.Module "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/modules [post]
17+
// @Id createModule
18+
// @Summary Create module
19+
// @Description Create a new Kusion module
20+
// @Tags module
21+
// @Accept json
22+
// @Produce json
23+
// @Param module body request.CreateModuleRequest true "Created module"
24+
// @Success 200 {object} entity.Module "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/modules [post]
3131
func (h *Handler) CreateModule() http.HandlerFunc {
3232
return func(w http.ResponseWriter, r *http.Request) {
3333
// Getting stuff from context.
@@ -48,19 +48,19 @@ func (h *Handler) CreateModule() http.HandlerFunc {
4848
}
4949
}
5050

51-
// @Id deleteModule
52-
// @Summary Delete module
53-
// @Description Delete the specified module by name
54-
// @Tags module
55-
// @Produce json
56-
// @Param name path string true "Module Name"
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/modules/{name} [delete]
51+
// @Id deleteModule
52+
// @Summary Delete module
53+
// @Description Delete the specified module by name
54+
// @Tags module
55+
// @Produce json
56+
// @Param name path string true "Module Name"
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/modules/{name} [delete]
6464
func (h *Handler) DeleteModule() http.HandlerFunc {
6565
return func(w http.ResponseWriter, r *http.Request) {
6666
// Getting stuff from context.
@@ -76,21 +76,21 @@ func (h *Handler) DeleteModule() http.HandlerFunc {
7676
}
7777
}
7878

79-
// @Id updateModule
80-
// @Summary Update module
81-
// @Description Update the specified module
82-
// @Tags module
83-
// @Accept json
84-
// @Produce json
85-
// @Param name path string true "Module Name"
86-
// @Param module body request.UpdateModuleRequest true "Updated module"
87-
// @Success 200 {object} entity.Module "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/modules/{name} [put]
79+
// @Id updateModule
80+
// @Summary Update module
81+
// @Description Update the specified module
82+
// @Tags module
83+
// @Accept json
84+
// @Produce json
85+
// @Param name path string true "Module Name"
86+
// @Param module body request.UpdateModuleRequest true "Updated module"
87+
// @Success 200 {object} entity.Module "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/modules/{name} [put]
9494
func (h *Handler) UpdateModule() http.HandlerFunc {
9595
return func(w http.ResponseWriter, r *http.Request) {
9696
// Getting stuff from context.
@@ -114,19 +114,19 @@ func (h *Handler) UpdateModule() http.HandlerFunc {
114114
}
115115
}
116116

117-
// @Id getModule
118-
// @Summary Get module
119-
// @Description Get module information by module name
120-
// @Tags module
121-
// @Produce json
122-
// @Param name path string true "Module Name"
123-
// @Success 200 {object} entity.Module "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/modules/{name} [get]
117+
// @Id getModule
118+
// @Summary Get module
119+
// @Description Get module information by module name
120+
// @Tags module
121+
// @Produce json
122+
// @Param name path string true "Module Name"
123+
// @Success 200 {object} entity.Module "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/modules/{name} [get]
130130
func (h *Handler) GetModule() http.HandlerFunc {
131131
return func(w http.ResponseWriter, r *http.Request) {
132132
// Getting stuff from context.
@@ -142,19 +142,19 @@ func (h *Handler) GetModule() http.HandlerFunc {
142142
}
143143
}
144144

145-
// @Id listModule
146-
// @Summary List module
147-
// @Description List module information
148-
// @Tags module
149-
// @Produce json
150-
// @Param workspaceID query uint false "Workspace ID to filter module list by. Default to all workspaces."
151-
// @Success 200 {object} []entity.Module "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/modules [get]
145+
// @Id listModule
146+
// @Summary List module
147+
// @Description List module information
148+
// @Tags module
149+
// @Produce json
150+
// @Param workspaceID query uint false "Workspace ID to filter module list by. Default to all workspaces."
151+
// @Success 200 {object} []entity.Module "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/modules [get]
158158
func (h *Handler) ListModules() http.HandlerFunc {
159159
return func(w http.ResponseWriter, r *http.Request) {
160160
// Getting stuff from context.

‎pkg/server/handler/stack/execute_async.go

+71-71
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ import (
1919
logutil "kusionstack.io/kusion/pkg/server/util/logging"
2020
)
2121

22-
// @Id previewStackAsync
23-
// @Summary Asynchronously preview stack
24-
// @Description Start a run and asynchronously preview stack changes by stack ID
25-
// @Tags stack
26-
// @Produce json
27-
// @Param stack_id path int true "Stack ID"
28-
// @Param importedResources body request.StackImportRequest false "The resources to import during the stack preview"
29-
// @Param workspace query string true "The target workspace to preview the spec in."
30-
// @Param importResources query bool false "Import existing resources during the stack preview"
31-
// @Param output query string false "Output format. Choices are: json, default. Default to default output format in Kusion."
32-
// @Param detail query bool false "Show detailed output"
33-
// @Param specID query string false "The Spec ID to use for the preview. Default to the last one generated."
34-
// @Param force query bool false "Force the preview even when the stack is locked"
35-
// @Success 200 {object} entity.Run "Success"
36-
// @Failure 400 {object} error "Bad Request"
37-
// @Failure 401 {object} error "Unauthorized"
38-
// @Failure 429 {object} error "Too Many Requests"
39-
// @Failure 404 {object} error "Not Found"
40-
// @Failure 500 {object} error "Internal Server Error"
41-
// @Router /api/v1/stacks/{stack_id}/preview [post]
22+
// @Id previewStackAsync
23+
// @Summary Asynchronously preview stack
24+
// @Description Start a run and asynchronously preview stack changes by stack ID
25+
// @Tags stack
26+
// @Produce json
27+
// @Param stack_id path int true "Stack ID"
28+
// @Param importedResources body request.StackImportRequest false "The resources to import during the stack preview"
29+
// @Param workspace query string true "The target workspace to preview the spec in."
30+
// @Param importResources query bool false "Import existing resources during the stack preview"
31+
// @Param output query string false "Output format. Choices are: json, default. Default to default output format in Kusion."
32+
// @Param detail query bool false "Show detailed output"
33+
// @Param specID query string false "The Spec ID to use for the preview. Default to the last one generated."
34+
// @Param force query bool false "Force the preview even when the stack is locked"
35+
// @Success 200 {object} entity.Run "Success"
36+
// @Failure 400 {object} error "Bad Request"
37+
// @Failure 401 {object} error "Unauthorized"
38+
// @Failure 429 {object} error "Too Many Requests"
39+
// @Failure 404 {object} error "Not Found"
40+
// @Failure 500 {object} error "Internal Server Error"
41+
// @Router /api/v1/stacks/{stack_id}/preview [post]
4242
func (h *Handler) PreviewStackAsync() http.HandlerFunc {
4343
return func(w http.ResponseWriter, r *http.Request) {
4444
// Getting stuff from context
@@ -124,25 +124,25 @@ func (h *Handler) PreviewStackAsync() http.HandlerFunc {
124124
}
125125
}
126126

127-
// @Id applyStackAsync
128-
// @Summary Asynchronously apply stack
129-
// @Description Start a run and asynchronously apply stack changes by stack ID
130-
// @Tags stack
131-
// @Produce json
132-
// @Param stack_id path int true "Stack ID"
133-
// @Param importedResources body request.StackImportRequest false "The resources to import during the stack preview"
134-
// @Param workspace query string true "The target workspace to preview the spec in."
135-
// @Param importResources query bool false "Import existing resources during the stack preview"
136-
// @Param specID query string false "The Spec ID to use for the apply. Will generate a new spec if omitted."
137-
// @Param force query bool false "Force the apply even when the stack is locked. May cause concurrency issues!!!"
138-
// @Param dryrun query bool false "Apply in dry-run mode"
139-
// @Success 200 {object} entity.Run "Success"
140-
// @Failure 400 {object} error "Bad Request"
141-
// @Failure 401 {object} error "Unauthorized"
142-
// @Failure 429 {object} error "Too Many Requests"
143-
// @Failure 404 {object} error "Not Found"
144-
// @Failure 500 {object} error "Internal Server Error"
145-
// @Router /api/v1/stacks/{stack_id}/apply/async [post]
127+
// @Id applyStackAsync
128+
// @Summary Asynchronously apply stack
129+
// @Description Start a run and asynchronously apply stack changes by stack ID
130+
// @Tags stack
131+
// @Produce json
132+
// @Param stack_id path int true "Stack ID"
133+
// @Param importedResources body request.StackImportRequest false "The resources to import during the stack preview"
134+
// @Param workspace query string true "The target workspace to preview the spec in."
135+
// @Param importResources query bool false "Import existing resources during the stack preview"
136+
// @Param specID query string false "The Spec ID to use for the apply. Will generate a new spec if omitted."
137+
// @Param force query bool false "Force the apply even when the stack is locked. May cause concurrency issues!!!"
138+
// @Param dryrun query bool false "Apply in dry-run mode"
139+
// @Success 200 {object} entity.Run "Success"
140+
// @Failure 400 {object} error "Bad Request"
141+
// @Failure 401 {object} error "Unauthorized"
142+
// @Failure 429 {object} error "Too Many Requests"
143+
// @Failure 404 {object} error "Not Found"
144+
// @Failure 500 {object} error "Internal Server Error"
145+
// @Router /api/v1/stacks/{stack_id}/apply/async [post]
146146
func (h *Handler) ApplyStackAsync() http.HandlerFunc {
147147
return func(w http.ResponseWriter, r *http.Request) {
148148
// Getting stuff from context
@@ -229,22 +229,22 @@ func (h *Handler) ApplyStackAsync() http.HandlerFunc {
229229
}
230230
}
231231

232-
// @Id generateStackAsync
233-
// @Summary Asynchronously generate stack
234-
// @Description Start a run and asynchronously generate stack spec by stack ID
235-
// @Tags stack
236-
// @Produce json
237-
// @Param stack_id path int true "Stack ID"
238-
// @Param workspace query string true "The target workspace to preview the spec in."
239-
// @Param format query string false "The format to generate the spec in. Choices are: spec. Default to spec."
240-
// @Param force query bool false "Force the generate even when the stack is locked"
241-
// @Success 200 {object} apiv1.Spec "Success"
242-
// @Failure 400 {object} error "Bad Request"
243-
// @Failure 401 {object} error "Unauthorized"
244-
// @Failure 429 {object} error "Too Many Requests"
245-
// @Failure 404 {object} error "Not Found"
246-
// @Failure 500 {object} error "Internal Server Error"
247-
// @Router /api/v1/stacks/{stack_id}/generate/async [post]
232+
// @Id generateStackAsync
233+
// @Summary Asynchronously generate stack
234+
// @Description Start a run and asynchronously generate stack spec by stack ID
235+
// @Tags stack
236+
// @Produce json
237+
// @Param stack_id path int true "Stack ID"
238+
// @Param workspace query string true "The target workspace to preview the spec in."
239+
// @Param format query string false "The format to generate the spec in. Choices are: spec. Default to spec."
240+
// @Param force query bool false "Force the generate even when the stack is locked"
241+
// @Success 200 {object} apiv1.Spec "Success"
242+
// @Failure 400 {object} error "Bad Request"
243+
// @Failure 401 {object} error "Unauthorized"
244+
// @Failure 429 {object} error "Too Many Requests"
245+
// @Failure 404 {object} error "Not Found"
246+
// @Failure 500 {object} error "Internal Server Error"
247+
// @Router /api/v1/stacks/{stack_id}/generate/async [post]
248248
func (h *Handler) GenerateStackAsync() http.HandlerFunc {
249249
return func(w http.ResponseWriter, r *http.Request) {
250250
// Getting stuff from context
@@ -325,22 +325,22 @@ func (h *Handler) GenerateStackAsync() http.HandlerFunc {
325325
}
326326
}
327327

328-
// @Id destroyStackAsync
329-
// @Summary Asynchronously destroy stack
330-
// @Description Start a run and asynchronously destroy stack resources by stack ID
331-
// @Tags stack
332-
// @Produce json
333-
// @Param stack_id path int true "Stack ID"
334-
// @Param workspace query string true "The target workspace to preview the spec in."
335-
// @Param force query bool false "Force the destroy even when the stack is locked. May cause concurrency issues!!!"
336-
// @Param dryrun query bool false "Destroy in dry-run mode"
337-
// @Success 200 {object} string "Success"
338-
// @Failure 400 {object} error "Bad Request"
339-
// @Failure 401 {object} error "Unauthorized"
340-
// @Failure 429 {object} error "Too Many Requests"
341-
// @Failure 404 {object} error "Not Found"
342-
// @Failure 500 {object} error "Internal Server Error"
343-
// @Router /api/v1/stacks/{stack_id}/destroy/async [post]
328+
// @Id destroyStackAsync
329+
// @Summary Asynchronously destroy stack
330+
// @Description Start a run and asynchronously destroy stack resources by stack ID
331+
// @Tags stack
332+
// @Produce json
333+
// @Param stack_id path int true "Stack ID"
334+
// @Param workspace query string true "The target workspace to preview the spec in."
335+
// @Param force query bool false "Force the destroy even when the stack is locked. May cause concurrency issues!!!"
336+
// @Param dryrun query bool false "Destroy in dry-run mode"
337+
// @Success 200 {object} string "Success"
338+
// @Failure 400 {object} error "Bad Request"
339+
// @Failure 401 {object} error "Unauthorized"
340+
// @Failure 429 {object} error "Too Many Requests"
341+
// @Failure 404 {object} error "Not Found"
342+
// @Failure 500 {object} error "Internal Server Error"
343+
// @Router /api/v1/stacks/{stack_id}/destroy/async [post]
344344
func (h *Handler) DestroyStackAsync() http.HandlerFunc {
345345
return func(w http.ResponseWriter, r *http.Request) {
346346
// Getting stuff from context

0 commit comments

Comments
 (0)