diff --git a/api/queryService/api.gen.go b/api/queryService/api.gen.go index c339a632..c526a144 100644 --- a/api/queryService/api.gen.go +++ b/api/queryService/api.gen.go @@ -62,7 +62,7 @@ type ClientUpdate struct { // ExportDetails Payload for export trigger response. type ExportDetails struct { // JobId The job id relative to the export. - JobId *openapi_types.UUID `json:"job_id,omitempty"` + JobId openapi_types.UUID `json:"job_id"` // OutputLocation The location in which the export zip file will be found. OutputLocation *string `json:"output_location,omitempty"` @@ -307,9 +307,6 @@ type ServerInterface interface { // Trigger an export // (POST /job/export) TriggerExport(ctx echo.Context) error - // Check export state. - // (GET /job/export/{id}) - ExportState(ctx echo.Context, id openapi_types.UUID) error // Get a job by ID // (GET /job/{id}) GetJob(ctx echo.Context, id openapi_types.UUID) error @@ -322,6 +319,9 @@ type ServerInterface interface { // Update a job collector // (PATCH /job/{id}/collector) UpdateJobCollectorByJobId(ctx echo.Context, id openapi_types.UUID) error + // Check export state. + // (GET /job/{id}/export) + ExportState(ctx echo.Context, id openapi_types.UUID) error // List queries // (GET /query) ListQueries(ctx echo.Context) error @@ -403,22 +403,6 @@ func (w *ServerInterfaceWrapper) TriggerExport(ctx echo.Context) error { return err } -// ExportState converts echo context to params. -func (w *ServerInterfaceWrapper) ExportState(ctx echo.Context) error { - var err error - // ------------- Path parameter "id" ------------- - var id openapi_types.UUID - - err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err)) - } - - // Invoke the callback with all the unmarshaled arguments - err = w.Handler.ExportState(ctx, id) - return err -} - // GetJob converts echo context to params. func (w *ServerInterfaceWrapper) GetJob(ctx echo.Context) error { var err error @@ -483,6 +467,22 @@ func (w *ServerInterfaceWrapper) UpdateJobCollectorByJobId(ctx echo.Context) err return err } +// ExportState converts echo context to params. +func (w *ServerInterfaceWrapper) ExportState(ctx echo.Context) error { + var err error + // ------------- Path parameter "id" ------------- + var id openapi_types.UUID + + err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.ExportState(ctx, id) + return err +} + // ListQueries converts echo context to params. func (w *ServerInterfaceWrapper) ListQueries(ctx echo.Context) error { var err error @@ -582,11 +582,11 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL router.PATCH(baseURL+"/client/:id", wrapper.UpdateClient) router.POST(baseURL+"/job", wrapper.CreateJob) router.POST(baseURL+"/job/export", wrapper.TriggerExport) - router.GET(baseURL+"/job/export/:id", wrapper.ExportState) router.GET(baseURL+"/job/:id", wrapper.GetJob) router.PATCH(baseURL+"/job/:id", wrapper.UpdateJob) router.GET(baseURL+"/job/:id/collector", wrapper.GetJobCollectorByJobId) router.PATCH(baseURL+"/job/:id/collector", wrapper.UpdateJobCollectorByJobId) + router.GET(baseURL+"/job/:id/export", wrapper.ExportState) router.GET(baseURL+"/query", wrapper.ListQueries) router.POST(baseURL+"/query", wrapper.CreateQuery) router.GET(baseURL+"/query/:id", wrapper.GetQuery) @@ -604,41 +604,41 @@ var swaggerSpec = []string{ "9gIWK2KqNXBNqBDygadrQpnhOyB2mq7WFUspgKZW5dN31Fr91fdMKvMeDOVCt2V+pnshaUJWUhFwQ4lR", "fL0GRRToTKYaptHkaM93Ml7ypHuBdzImPCEKBHWbNNKhgLKtqJVUW2qieZTnPGnvYRLJ3GS5WQrJKMrt", "UlN8JTwlDxvONjUt5A+ekRUXQB64ECQGspJ5mljl8J1uM+H0vZ3PZo9xzn4Hc5g9Iq48Ocwe72Ts/jV8", - "C9rQbXZYPqJgnhymf/Csa9HaUJM7cP6tYBXNo3/NKj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wJtMVX7elX7rf5wrvsAoyl5IH1czdh4/uFb58gXEOCoWplr30KEb6", - "zLJ432RK736Ogxv+PIBiN3ZgZ13gRLRSeQu6IPWCoeUsaqTwcIIef1eA3ewgcjegzRdwFyht+IqM0xmb", - "q6K7TExGEkdjuqY81cNuorH+CDrH/zo8wurJNaDdQNuC4ykVaX13x+vowQsv7duAuQue9ia+uBLtaA+A", - "AJ3OVygwvBrPjFBGctl7n0EroBS3Q9dfP/2yvPr15su7y5tPX6JJdPnpl5urX2+WH759/Nh5e+P0hrJk", - "X8DHeclR0H9mnC+EsjPjfb9DF5LFKI7dTvwHdz++ku2VvPu8KN2suT9nD/JJsQ1o4/euQe04wwrAcON6", - "MV3j3n1eRJOotFb0ZnoxvXDtoQxSmvFoHr2dXkzf2vKdmo3b5IxVVzsSg8ZRbHWxWBPq4qmv3h64we5R", - "puSOJ5CQBLtlU7x1xAUtknK+v0BCK4E2P8lk7yO68epplgmOHarZnUa6YTjsC5aNVueh6XNG5eB+gT7u", - "9vzDxZsX013dfjrFR9ghWsytLCE6Zwy0XuVC7KfWLj9eXHQE4nRHhWsHOqRILBM7+jCJdL7dUluYeVAb", - "NrHcoGttowCq/YqsiW7tVG/m2SNPDlblGkxXXDOKw84ZW2PQYYXF4z3hRpPF+7aFfwZTM28D54sXw7m6", - "hAzjXHJwKLT1rpOb82MH//11oTRFS7Rpip/BEFpDafH+hCWs4xUqo/lvpy+/vEwjifKGceHJDrTuW9xM", - "zrHmalJ+UoO170h168IB24QCpsaeJHeZuREBLPuCjo+T/wTH99lrkONfBA2c++TwLCcdyKEjCuEGShb1", - "ePKd720MiNb21Hp2qL6W8Ujmqi4NXlOQvpbx2BH6zkFaGPVaxi2LzrD9GzbsIuWGO9PWHm1kStrlti3p", - "Hx3gC4SRrNl83vCaLHrVeJQzkk9b2gSTgkelesxRM79/kxJgwOkMfbkB9jtSgOVK2aDiHqvYlNF4ONKk", - "Q/UMBsbM0c13U2HDbKgmMUBKymc1YZivqmc5QbQ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r2V7Ju8+L0s2a+3P2IJ8U24A2fu8a1I4zrAAMN64V0zXu", + "3edFNIlKa0VvphfTC9cdyiClGY/m0dvpxfStLd+p2bhNzlh1qyMxaBzFVheLNaEunvrq7YEbbB5lSu54", + "AglJsFk2xQtHXNAiKef7uyO0Emjzk0z2PqIbr55mmeDYoJrdaaQbhsO+YNnodB6aPmdUDu4X6ONuzz9c", + "vHkx3dXFp1N8hB2ixdzKEqJzxkDrVS7Efmrt8uPFRUcgTndUuG6gQ4rEMrGjD5NI59sttYWZB7VhE8sN", + "utY2CqDar8ia6NZO9WaePfLkYFWuwXTFNaM47JyxNQYdVlg83hNuNFm8b1v4ZzA18zZwvngxnKv7xzDO", + "JQeHQltvOLk5P3bw398USlN0RJum+BkMoTWUFu9PWMI6XqEymv92+t7LyzSSKG8YF57sQOu+xaXkHGuu", + "JuUnNVj7jlS3LhywTShgamxHcpeZGxHAsi/o+Dj5T3B8n70GOf5F0MC5Tw7PctKBHDqiEG6gZFGPJ9/5", + "tsaAaG1PrWeH6msZj2Su6tLgNQXpaxmPHaHvHKSFUa9l3LLoDDu/YcMuUm64M23tzUampF1u25L+vQE+", + "PhjJms2XDa/JoleNNzkj+bSlTTApeFSqdxw18/vnKC0GnJ+a3eXZybxc+PJ4STnkUaPk4pOYYyL2mDSy", + "cMPhBqRgKwMB/auTbRnAB2TaUeP2OTk2YLgxE+xJYpTpdUAYtk44Y/Um7nnuWE7td8yyzfDT/lrGi2Ts", + "6rncVCgHlktv+m4A7mr4AI9swHLsm+XKnuCk5bm52el5BW5bbfkMB+7kxDiF2FEf8DmeXW11bB8fQLq6", + "t1fjexnXCABVMdbp/ZcbYL9jIcZypWxp716L2oNb4+Vm08rVO1QY09ebj5fD5dGGahIDpKR81xrG/qp6", + "FxsE3qFSVKYOj+mJquesk3CF6AiebS1/XzS8eqO9aDbl6s9r3QNXprgBxWnb/PUm4Ijmr6vpMP674x28", + "bIWG15JBjriWyn0JQkEON6vBjQGHW7y0Pft4i73NceJqvXn1mg5EaJWRD7n3HtiAUUs3e8JBB019uqKq", + "7DqSY/m2egjdUQ48Pe6EBVaJTqOwavvU8HhbNln+6kKq5uMDCqjRXfuZN41ozTFrpB6+lLXRWb46M0U3", + "+dUwqDM9XH0HlmN+cG1rlbs+Mw1miubfmxzdoIE2o/Op3q0fTqqX1u+73x2R7cbB6B8kPidROEH9tLNz", + "QO26CfZZySRnZUMUbE2fKxHNo40xmZ7PZjTjU//HalMmt7Pdm8iyxWs7lvepsLfGP7yDhBjpr+B1xdbm", + "FfxhMkzMnYxrMmpXDWcIqE4vTVGt08tQmVXh5YU18B8qBYvxmpRmaX+4Pfw/AAD///6KTOeVOgAA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/pkg/queryService/api.gen.go b/pkg/queryService/api.gen.go index 062f9555..19b59d02 100644 --- a/pkg/queryService/api.gen.go +++ b/pkg/queryService/api.gen.go @@ -60,7 +60,7 @@ type ClientUpdate struct { // ExportDetails Payload for export trigger response. type ExportDetails struct { // JobId The job id relative to the export. - JobId *openapi_types.UUID `json:"job_id,omitempty"` + JobId openapi_types.UUID `json:"job_id"` // OutputLocation The location in which the export zip file will be found. OutputLocation *string `json:"output_location,omitempty"` @@ -384,9 +384,6 @@ type ClientInterface interface { TriggerExport(ctx context.Context, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // ExportState request - ExportState(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetJob request GetJob(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -403,6 +400,9 @@ type ClientInterface interface { UpdateJobCollectorByJobId(ctx context.Context, id openapi_types.UUID, body UpdateJobCollectorByJobIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // ExportState request + ExportState(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListQueries request ListQueries(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -533,18 +533,6 @@ func (c *Client) TriggerExport(ctx context.Context, body TriggerExportJSONReques return c.Client.Do(req) } -func (c *Client) ExportState(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewExportStateRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - func (c *Client) GetJob(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetJobRequest(c.Server, id) if err != nil { @@ -617,6 +605,18 @@ func (c *Client) UpdateJobCollectorByJobId(ctx context.Context, id openapi_types return c.Client.Do(req) } +func (c *Client) ExportState(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewExportStateRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) ListQueries(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListQueriesRequest(c.Server) if err != nil { @@ -914,40 +914,6 @@ func NewTriggerExportRequestWithBody(server string, contentType string, body io. return req, nil } -// NewExportStateRequest generates requests for ExportState -func NewExportStateRequest(server string, id openapi_types.UUID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/job/export/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - // NewGetJobRequest generates requests for GetJob func NewGetJobRequest(server string, id openapi_types.UUID) (*http.Request, error) { var err error @@ -1110,6 +1076,40 @@ func NewUpdateJobCollectorByJobIdRequestWithBody(server string, id openapi_types return req, nil } +// NewExportStateRequest generates requests for ExportState +func NewExportStateRequest(server string, id openapi_types.UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/job/%s/export", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewListQueriesRequest generates requests for ListQueries func NewListQueriesRequest(server string) (*http.Request, error) { var err error @@ -1371,9 +1371,6 @@ type ClientWithResponsesInterface interface { TriggerExportWithResponse(ctx context.Context, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error) - // ExportStateWithResponse request - ExportStateWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*ExportStateResponse, error) - // GetJobWithResponse request GetJobWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetJobResponse, error) @@ -1390,6 +1387,9 @@ type ClientWithResponsesInterface interface { UpdateJobCollectorByJobIdWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateJobCollectorByJobIdJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateJobCollectorByJobIdResponse, error) + // ExportStateWithResponse request + ExportStateWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*ExportStateResponse, error) + // ListQueriesWithResponse request ListQueriesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListQueriesResponse, error) @@ -1521,28 +1521,6 @@ func (r TriggerExportResponse) StatusCode() int { return 0 } -type ExportStateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ExportDetails -} - -// Status returns HTTPResponse.Status -func (r ExportStateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ExportStateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - type GetJobResponse struct { Body []byte HTTPResponse *http.Response @@ -1629,6 +1607,28 @@ func (r UpdateJobCollectorByJobIdResponse) StatusCode() int { return 0 } +type ExportStateResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ExportDetails +} + +// Status returns HTTPResponse.Status +func (r ExportStateResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ExportStateResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type ListQueriesResponse struct { Body []byte HTTPResponse *http.Response @@ -1815,15 +1815,6 @@ func (c *ClientWithResponses) TriggerExportWithResponse(ctx context.Context, bod return ParseTriggerExportResponse(rsp) } -// ExportStateWithResponse request returning *ExportStateResponse -func (c *ClientWithResponses) ExportStateWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*ExportStateResponse, error) { - rsp, err := c.ExportState(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseExportStateResponse(rsp) -} - // GetJobWithResponse request returning *GetJobResponse func (c *ClientWithResponses) GetJobWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetJobResponse, error) { rsp, err := c.GetJob(ctx, id, reqEditors...) @@ -1876,6 +1867,15 @@ func (c *ClientWithResponses) UpdateJobCollectorByJobIdWithResponse(ctx context. return ParseUpdateJobCollectorByJobIdResponse(rsp) } +// ExportStateWithResponse request returning *ExportStateResponse +func (c *ClientWithResponses) ExportStateWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*ExportStateResponse, error) { + rsp, err := c.ExportState(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseExportStateResponse(rsp) +} + // ListQueriesWithResponse request returning *ListQueriesResponse func (c *ClientWithResponses) ListQueriesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListQueriesResponse, error) { rsp, err := c.ListQueries(ctx, reqEditors...) @@ -2065,32 +2065,6 @@ func ParseTriggerExportResponse(rsp *http.Response) (*TriggerExportResponse, err return response, nil } -// ParseExportStateResponse parses an HTTP response from a ExportStateWithResponse call -func ParseExportStateResponse(rsp *http.Response) (*ExportStateResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ExportStateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ExportDetails - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - // ParseGetJobResponse parses an HTTP response from a GetJobWithResponse call func ParseGetJobResponse(rsp *http.Response) (*GetJobResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -2175,6 +2149,32 @@ func ParseUpdateJobCollectorByJobIdResponse(rsp *http.Response) (*UpdateJobColle return response, nil } +// ParseExportStateResponse parses an HTTP response from a ExportStateWithResponse call +func ParseExportStateResponse(rsp *http.Response) (*ExportStateResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ExportStateResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest ExportDetails + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseListQueriesResponse parses an HTTP response from a ListQueriesWithResponse call func ParseListQueriesResponse(rsp *http.Response) (*ListQueriesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/scripts/Taskfile.yml b/scripts/Taskfile.yml index 7d3631c9..db37c53e 100644 --- a/scripts/Taskfile.yml +++ b/scripts/Taskfile.yml @@ -62,7 +62,7 @@ tasks: lint:fix: cmds: - task go:lint:fix - - task openapi:lint:fix + - task openapi:lint - task db:lint - task yaml:lint - task json:lint:fix diff --git a/scripts/openapi.yml b/scripts/openapi.yml index dcf9a536..3e79c172 100644 --- a/scripts/openapi.yml +++ b/scripts/openapi.yml @@ -6,10 +6,7 @@ version: '3' tasks: lint: cmds: - - echo "OpenAPI lint" - lint:fix: - cmds: - - echo "OpenAPI lint:fix" + - vacuum lint ./serviceAPIs/queryService.yaml -d generate: deps: - generate:server diff --git a/serviceAPIs/queryService.yaml b/serviceAPIs/queryService.yaml index 57e1c343..68fccc17 100644 --- a/serviceAPIs/queryService.yaml +++ b/serviceAPIs/queryService.yaml @@ -344,7 +344,7 @@ paths: '404': description: Job not found. - /job/export/{id}: + /job/{id}/export: parameters: - in: path name: id @@ -388,7 +388,6 @@ components: description: Unique identifier for the query. type: $ref: '#/components/schemas/QueryType' - description: Type of the query. active_version: type: integer format: int32 @@ -428,7 +427,6 @@ components: properties: type: $ref: '#/components/schemas/QueryType' - description: Type of the query to create. config: type: string description: Configuration for the new query. @@ -595,7 +593,6 @@ components: $ref: '#/components/schemas/JobCollectorField' description: JobCollector model. required: - - id - job_id - fields - minimum_cleaner_version @@ -721,5 +718,5 @@ components: example: s3://{bucket}/{clientid}/{jobid}/{timestamp}_{exportid}.zip description: Payload for export trigger response. required: - - id + - job_id - status diff --git a/vaccum.conf.yaml b/vaccum.conf.yaml new file mode 100644 index 00000000..e69de29b