From e43f4bd0f067da0e639efa93f88451ba0aa9596a Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 2 Jan 2025 18:33:38 -0800 Subject: [PATCH] openapi-internal: remove unused endpoint --- openapi-internal.yaml | 17 -- pkg/internal/oas_client_gen.go | 97 --------- pkg/internal/oas_handlers_gen.go | 149 -------------- pkg/internal/oas_operations_gen.go | 1 - pkg/internal/oas_parameters_gen.go | 66 ------ pkg/internal/oas_response_decoders_gen.go | 51 ----- pkg/internal/oas_response_encoders_gen.go | 7 - pkg/internal/oas_router_gen.go | 240 ++++++++-------------- pkg/internal/oas_schemas_gen.go | 3 - pkg/internal/oas_server_gen.go | 6 - pkg/internal/oas_unimplemented_gen.go | 9 - pkg/service_internal/submissions.go | 14 -- validation/api/src/internal.rs | 1 - 13 files changed, 81 insertions(+), 580 deletions(-) diff --git a/openapi-internal.yaml b/openapi-internal.yaml index 89f9f66..88589f7 100644 --- a/openapi-internal.yaml +++ b/openapi-internal.yaml @@ -92,23 +92,6 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - /submissions/{SubmissionID}/status/releaser-released: - post: - summary: (Internal endpoint) Role Releaser changes status from releasing -> released - operationId: actionSubmissionReleased - tags: - - Submissions - parameters: - - $ref: '#/components/parameters/SubmissionID' - responses: - "204": - description: Successful response - default: - description: General Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" /script-policy: get: summary: Get list of script policies diff --git a/pkg/internal/oas_client_gen.go b/pkg/internal/oas_client_gen.go index f279873..acd1b64 100644 --- a/pkg/internal/oas_client_gen.go +++ b/pkg/internal/oas_client_gen.go @@ -29,12 +29,6 @@ type Invoker interface { // // POST /submissions/{SubmissionID}/status/validator-failed ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error - // ActionSubmissionReleased invokes actionSubmissionReleased operation. - // - // (Internal endpoint) Role Releaser changes status from releasing -> released. - // - // POST /submissions/{SubmissionID}/status/releaser-released - ActionSubmissionReleased(ctx context.Context, params ActionSubmissionReleasedParams) error // ActionSubmissionUploaded invokes actionSubmissionUploaded operation. // // (Internal endpoint) Role Validator changes status from Uploading -> Uploaded. @@ -228,97 +222,6 @@ func (c *Client) sendActionSubmissionAccepted(ctx context.Context, params Action return result, nil } -// ActionSubmissionReleased invokes actionSubmissionReleased operation. -// -// (Internal endpoint) Role Releaser changes status from releasing -> released. -// -// POST /submissions/{SubmissionID}/status/releaser-released -func (c *Client) ActionSubmissionReleased(ctx context.Context, params ActionSubmissionReleasedParams) error { - _, err := c.sendActionSubmissionReleased(ctx, params) - return err -} - -func (c *Client) sendActionSubmissionReleased(ctx context.Context, params ActionSubmissionReleasedParams) (res *ActionSubmissionReleasedNoContent, err error) { - otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("actionSubmissionReleased"), - semconv.HTTPRequestMethodKey.String("POST"), - semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/releaser-released"), - } - - // Run stopwatch. - startTime := time.Now() - defer func() { - // Use floating point division here for higher precision (instead of Millisecond method). - elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) - }() - - // Increment request counter. - c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) - - // Start a span for this request. - ctx, span := c.cfg.Tracer.Start(ctx, ActionSubmissionReleasedOperation, - trace.WithAttributes(otelAttrs...), - clientSpanKind, - ) - // Track stage for error reporting. - var stage string - defer func() { - if err != nil { - span.RecordError(err) - span.SetStatus(codes.Error, stage) - c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) - } - span.End() - }() - - stage = "BuildURL" - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/submissions/" - { - // Encode "SubmissionID" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "SubmissionID", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.Int64ToString(params.SubmissionID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/status/releaser-released" - uri.AddPathParts(u, pathParts[:]...) - - stage = "EncodeRequest" - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - stage = "SendRequest" - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - stage = "DecodeResponse" - result, err := decodeActionSubmissionReleasedResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - // ActionSubmissionUploaded invokes actionSubmissionUploaded operation. // // (Internal endpoint) Role Validator changes status from Uploading -> Uploaded. diff --git a/pkg/internal/oas_handlers_gen.go b/pkg/internal/oas_handlers_gen.go index 14b104a..bf0de11 100644 --- a/pkg/internal/oas_handlers_gen.go +++ b/pkg/internal/oas_handlers_gen.go @@ -179,155 +179,6 @@ func (s *Server) handleActionSubmissionAcceptedRequest(args [1]string, argsEscap } } -// handleActionSubmissionReleasedRequest handles actionSubmissionReleased operation. -// -// (Internal endpoint) Role Releaser changes status from releasing -> released. -// -// POST /submissions/{SubmissionID}/status/releaser-released -func (s *Server) handleActionSubmissionReleasedRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { - statusWriter := &codeRecorder{ResponseWriter: w} - w = statusWriter - otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("actionSubmissionReleased"), - semconv.HTTPRequestMethodKey.String("POST"), - semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/releaser-released"), - } - - // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), ActionSubmissionReleasedOperation, - trace.WithAttributes(otelAttrs...), - serverSpanKind, - ) - defer span.End() - - // Add Labeler to context. - labeler := &Labeler{attrs: otelAttrs} - ctx = contextWithLabeler(ctx, labeler) - - // Run stopwatch. - startTime := time.Now() - defer func() { - elapsedDuration := time.Since(startTime) - - attrSet := labeler.AttributeSet() - attrs := attrSet.ToSlice() - code := statusWriter.status - if code != 0 { - codeAttr := semconv.HTTPResponseStatusCode(code) - attrs = append(attrs, codeAttr) - span.SetAttributes(codeAttr) - } - attrOpt := metric.WithAttributes(attrs...) - - // Increment request counter. - s.requests.Add(ctx, 1, attrOpt) - - // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) - }() - - var ( - recordError = func(stage string, err error) { - span.RecordError(err) - - // https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status - // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, - // unless there was another error (e.g., network error receiving the response body; or 3xx codes with - // max redirects exceeded), in which case status MUST be set to Error. - code := statusWriter.status - if code >= 100 && code < 500 { - span.SetStatus(codes.Error, stage) - } - - attrSet := labeler.AttributeSet() - attrs := attrSet.ToSlice() - if code != 0 { - attrs = append(attrs, semconv.HTTPResponseStatusCode(code)) - } - - s.errors.Add(ctx, 1, metric.WithAttributes(attrs...)) - } - err error - opErrContext = ogenerrors.OperationContext{ - Name: ActionSubmissionReleasedOperation, - ID: "actionSubmissionReleased", - } - ) - params, err := decodeActionSubmissionReleasedParams(args, argsEscaped, r) - if err != nil { - err = &ogenerrors.DecodeParamsError{ - OperationContext: opErrContext, - Err: err, - } - defer recordError("DecodeParams", err) - s.cfg.ErrorHandler(ctx, w, r, err) - return - } - - var response *ActionSubmissionReleasedNoContent - if m := s.cfg.Middleware; m != nil { - mreq := middleware.Request{ - Context: ctx, - OperationName: ActionSubmissionReleasedOperation, - OperationSummary: "(Internal endpoint) Role Releaser changes status from releasing -> released", - OperationID: "actionSubmissionReleased", - Body: nil, - Params: middleware.Parameters{ - { - Name: "SubmissionID", - In: "path", - }: params.SubmissionID, - }, - Raw: r, - } - - type ( - Request = struct{} - Params = ActionSubmissionReleasedParams - Response = *ActionSubmissionReleasedNoContent - ) - response, err = middleware.HookMiddleware[ - Request, - Params, - Response, - ]( - m, - mreq, - unpackActionSubmissionReleasedParams, - func(ctx context.Context, request Request, params Params) (response Response, err error) { - err = s.h.ActionSubmissionReleased(ctx, params) - return response, err - }, - ) - } else { - err = s.h.ActionSubmissionReleased(ctx, params) - } - if err != nil { - if errRes, ok := errors.Into[*ErrorStatusCode](err); ok { - if err := encodeErrorResponse(errRes, w, span); err != nil { - defer recordError("Internal", err) - } - return - } - if errors.Is(err, ht.ErrNotImplemented) { - s.cfg.ErrorHandler(ctx, w, r, err) - return - } - if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil { - defer recordError("Internal", err) - } - return - } - - if err := encodeActionSubmissionReleasedResponse(response, w, span); err != nil { - defer recordError("EncodeResponse", err) - if !errors.Is(err, ht.ErrInternalServerErrorResponse) { - s.cfg.ErrorHandler(ctx, w, r, err) - } - return - } -} - // handleActionSubmissionUploadedRequest handles actionSubmissionUploaded operation. // // (Internal endpoint) Role Validator changes status from Uploading -> Uploaded. diff --git a/pkg/internal/oas_operations_gen.go b/pkg/internal/oas_operations_gen.go index ad092f8..1bcd594 100644 --- a/pkg/internal/oas_operations_gen.go +++ b/pkg/internal/oas_operations_gen.go @@ -7,7 +7,6 @@ type OperationName = string const ( ActionSubmissionAcceptedOperation OperationName = "ActionSubmissionAccepted" - ActionSubmissionReleasedOperation OperationName = "ActionSubmissionReleased" ActionSubmissionUploadedOperation OperationName = "ActionSubmissionUploaded" ActionSubmissionValidatedOperation OperationName = "ActionSubmissionValidated" CreateScriptOperation OperationName = "CreateScript" diff --git a/pkg/internal/oas_parameters_gen.go b/pkg/internal/oas_parameters_gen.go index ebab54c..73bf57c 100644 --- a/pkg/internal/oas_parameters_gen.go +++ b/pkg/internal/oas_parameters_gen.go @@ -81,72 +81,6 @@ func decodeActionSubmissionAcceptedParams(args [1]string, argsEscaped bool, r *h return params, nil } -// ActionSubmissionReleasedParams is parameters of actionSubmissionReleased operation. -type ActionSubmissionReleasedParams struct { - // The unique identifier for a submission. - SubmissionID int64 -} - -func unpackActionSubmissionReleasedParams(packed middleware.Parameters) (params ActionSubmissionReleasedParams) { - { - key := middleware.ParameterKey{ - Name: "SubmissionID", - In: "path", - } - params.SubmissionID = packed[key].(int64) - } - return params -} - -func decodeActionSubmissionReleasedParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionSubmissionReleasedParams, _ error) { - // Decode path: SubmissionID. - if err := func() error { - param := args[0] - if argsEscaped { - unescaped, err := url.PathUnescape(args[0]) - if err != nil { - return errors.Wrap(err, "unescape path") - } - param = unescaped - } - if len(param) > 0 { - d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "SubmissionID", - Value: param, - Style: uri.PathStyleSimple, - Explode: false, - }) - - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } - - c, err := conv.ToInt64(val) - if err != nil { - return err - } - - params.SubmissionID = c - return nil - }(); err != nil { - return err - } - } else { - return validate.ErrFieldRequired - } - return nil - }(); err != nil { - return params, &ogenerrors.DecodeParamError{ - Name: "SubmissionID", - In: "path", - Err: err, - } - } - return params, nil -} - // ActionSubmissionUploadedParams is parameters of actionSubmissionUploaded operation. type ActionSubmissionUploadedParams struct { // The unique identifier for a submission. diff --git a/pkg/internal/oas_response_decoders_gen.go b/pkg/internal/oas_response_decoders_gen.go index b1abc6f..8dcec9a 100644 --- a/pkg/internal/oas_response_decoders_gen.go +++ b/pkg/internal/oas_response_decoders_gen.go @@ -66,57 +66,6 @@ func decodeActionSubmissionAcceptedResponse(resp *http.Response) (res *ActionSub return res, errors.Wrap(defRes, "error") } -func decodeActionSubmissionReleasedResponse(resp *http.Response) (res *ActionSubmissionReleasedNoContent, _ error) { - switch resp.StatusCode { - case 204: - // Code 204. - return &ActionSubmissionReleasedNoContent{}, nil - } - // Convenient error response. - defRes, err := func() (res *ErrorStatusCode, err error) { - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response Error - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &ErrorStatusCode{ - StatusCode: resp.StatusCode, - Response: response, - }, nil - default: - return res, validate.InvalidContentType(ct) - } - }() - if err != nil { - return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode) - } - return res, errors.Wrap(defRes, "error") -} - func decodeActionSubmissionUploadedResponse(resp *http.Response) (res *ActionSubmissionUploadedNoContent, _ error) { switch resp.StatusCode { case 204: diff --git a/pkg/internal/oas_response_encoders_gen.go b/pkg/internal/oas_response_encoders_gen.go index 345b8f5..da7f379 100644 --- a/pkg/internal/oas_response_encoders_gen.go +++ b/pkg/internal/oas_response_encoders_gen.go @@ -20,13 +20,6 @@ func encodeActionSubmissionAcceptedResponse(response *ActionSubmissionAcceptedNo return nil } -func encodeActionSubmissionReleasedResponse(response *ActionSubmissionReleasedNoContent, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(204) - span.SetStatus(codes.Ok, http.StatusText(204)) - - return nil -} - func encodeActionSubmissionUploadedResponse(response *ActionSubmissionUploadedNoContent, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(204) span.SetStatus(codes.Ok, http.StatusText(204)) diff --git a/pkg/internal/oas_router_gen.go b/pkg/internal/oas_router_gen.go index 11c3fcc..ff71033 100644 --- a/pkg/internal/oas_router_gen.go +++ b/pkg/internal/oas_router_gen.go @@ -207,9 +207,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } elem = origElem - case 's': // Prefix: "status/" + case 's': // Prefix: "status/validator-" origElem := elem - if l := len("status/"); len(elem) >= l && elem[0:l] == "status/" { + if l := len("status/validator-"); len(elem) >= l && elem[0:l] == "status/validator-" { elem = elem[l:] } else { break @@ -219,9 +219,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { break } switch elem[0] { - case 'r': // Prefix: "releaser-released" + case 'f': // Prefix: "failed" origElem := elem - if l := len("releaser-released"); len(elem) >= l && elem[0:l] == "releaser-released" { + if l := len("failed"); len(elem) >= l && elem[0:l] == "failed" { elem = elem[l:] } else { break @@ -231,7 +231,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Leaf node. switch r.Method { case "POST": - s.handleActionSubmissionReleasedRequest([1]string{ + s.handleActionSubmissionAcceptedRequest([1]string{ args[0], }, elemIsEscaped, w, r) default: @@ -242,87 +242,49 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } elem = origElem - case 'v': // Prefix: "validator-" + case 'u': // Prefix: "uploaded" origElem := elem - if l := len("validator-"); len(elem) >= l && elem[0:l] == "validator-" { + if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" { elem = elem[l:] } else { break } if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "POST": + s.handleActionSubmissionUploadedRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "POST") + } + + return + } + + elem = origElem + case 'v': // Prefix: "validated" + origElem := elem + if l := len("validated"); len(elem) >= l && elem[0:l] == "validated" { + elem = elem[l:] + } else { break } - switch elem[0] { - case 'f': // Prefix: "failed" - origElem := elem - if l := len("failed"); len(elem) >= l && elem[0:l] == "failed" { - elem = elem[l:] - } else { - break + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "POST": + s.handleActionSubmissionValidatedRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "POST") } - if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "POST": - s.handleActionSubmissionAcceptedRequest([1]string{ - args[0], - }, elemIsEscaped, w, r) - default: - s.notAllowed(w, r, "POST") - } - - return - } - - elem = origElem - case 'u': // Prefix: "uploaded" - origElem := elem - if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "POST": - s.handleActionSubmissionUploadedRequest([1]string{ - args[0], - }, elemIsEscaped, w, r) - default: - s.notAllowed(w, r, "POST") - } - - return - } - - elem = origElem - case 'v': // Prefix: "validated" - origElem := elem - if l := len("validated"); len(elem) >= l && elem[0:l] == "validated" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "POST": - s.handleActionSubmissionValidatedRequest([1]string{ - args[0], - }, elemIsEscaped, w, r) - default: - s.notAllowed(w, r, "POST") - } - - return - } - - elem = origElem + return } elem = origElem @@ -600,9 +562,9 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { } elem = origElem - case 's': // Prefix: "status/" + case 's': // Prefix: "status/validator-" origElem := elem - if l := len("status/"); len(elem) >= l && elem[0:l] == "status/" { + if l := len("status/validator-"); len(elem) >= l && elem[0:l] == "status/validator-" { elem = elem[l:] } else { break @@ -612,9 +574,9 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { break } switch elem[0] { - case 'r': // Prefix: "releaser-released" + case 'f': // Prefix: "failed" origElem := elem - if l := len("releaser-released"); len(elem) >= l && elem[0:l] == "releaser-released" { + if l := len("failed"); len(elem) >= l && elem[0:l] == "failed" { elem = elem[l:] } else { break @@ -624,10 +586,10 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { // Leaf node. switch method { case "POST": - r.name = ActionSubmissionReleasedOperation - r.summary = "(Internal endpoint) Role Releaser changes status from releasing -> released" - r.operationID = "actionSubmissionReleased" - r.pathPattern = "/submissions/{SubmissionID}/status/releaser-released" + r.name = ActionSubmissionAcceptedOperation + r.summary = "(Internal endpoint) Role Validator changes status from Validating -> Accepted" + r.operationID = "actionSubmissionAccepted" + r.pathPattern = "/submissions/{SubmissionID}/status/validator-failed" r.args = args r.count = 1 return r, true @@ -637,93 +599,53 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { } elem = origElem - case 'v': // Prefix: "validator-" + case 'u': // Prefix: "uploaded" origElem := elem - if l := len("validator-"); len(elem) >= l && elem[0:l] == "validator-" { + if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" { elem = elem[l:] } else { break } if len(elem) == 0 { + // Leaf node. + switch method { + case "POST": + r.name = ActionSubmissionUploadedOperation + r.summary = "(Internal endpoint) Role Validator changes status from Uploading -> Uploaded" + r.operationID = "actionSubmissionUploaded" + r.pathPattern = "/submissions/{SubmissionID}/status/validator-uploaded" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + + elem = origElem + case 'v': // Prefix: "validated" + origElem := elem + if l := len("validated"); len(elem) >= l && elem[0:l] == "validated" { + elem = elem[l:] + } else { break } - switch elem[0] { - case 'f': // Prefix: "failed" - origElem := elem - if l := len("failed"); len(elem) >= l && elem[0:l] == "failed" { - elem = elem[l:] - } else { - break - } - if len(elem) == 0 { - // Leaf node. - switch method { - case "POST": - r.name = ActionSubmissionAcceptedOperation - r.summary = "(Internal endpoint) Role Validator changes status from Validating -> Accepted" - r.operationID = "actionSubmissionAccepted" - r.pathPattern = "/submissions/{SubmissionID}/status/validator-failed" - r.args = args - r.count = 1 - return r, true - default: - return - } + if len(elem) == 0 { + // Leaf node. + switch method { + case "POST": + r.name = ActionSubmissionValidatedOperation + r.summary = "(Internal endpoint) Role Validator changes status from Validating -> Validated" + r.operationID = "actionSubmissionValidated" + r.pathPattern = "/submissions/{SubmissionID}/status/validator-validated" + r.args = args + r.count = 1 + return r, true + default: + return } - - elem = origElem - case 'u': // Prefix: "uploaded" - origElem := elem - if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - // Leaf node. - switch method { - case "POST": - r.name = ActionSubmissionUploadedOperation - r.summary = "(Internal endpoint) Role Validator changes status from Uploading -> Uploaded" - r.operationID = "actionSubmissionUploaded" - r.pathPattern = "/submissions/{SubmissionID}/status/validator-uploaded" - r.args = args - r.count = 1 - return r, true - default: - return - } - } - - elem = origElem - case 'v': // Prefix: "validated" - origElem := elem - if l := len("validated"); len(elem) >= l && elem[0:l] == "validated" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - // Leaf node. - switch method { - case "POST": - r.name = ActionSubmissionValidatedOperation - r.summary = "(Internal endpoint) Role Validator changes status from Validating -> Validated" - r.operationID = "actionSubmissionValidated" - r.pathPattern = "/submissions/{SubmissionID}/status/validator-validated" - r.args = args - r.count = 1 - return r, true - default: - return - } - } - - elem = origElem } elem = origElem diff --git a/pkg/internal/oas_schemas_gen.go b/pkg/internal/oas_schemas_gen.go index 2b4a6c5..4a4e049 100644 --- a/pkg/internal/oas_schemas_gen.go +++ b/pkg/internal/oas_schemas_gen.go @@ -13,9 +13,6 @@ func (s *ErrorStatusCode) Error() string { // ActionSubmissionAcceptedNoContent is response for ActionSubmissionAccepted operation. type ActionSubmissionAcceptedNoContent struct{} -// ActionSubmissionReleasedNoContent is response for ActionSubmissionReleased operation. -type ActionSubmissionReleasedNoContent struct{} - // ActionSubmissionUploadedNoContent is response for ActionSubmissionUploaded operation. type ActionSubmissionUploadedNoContent struct{} diff --git a/pkg/internal/oas_server_gen.go b/pkg/internal/oas_server_gen.go index 6b6d9f3..c679835 100644 --- a/pkg/internal/oas_server_gen.go +++ b/pkg/internal/oas_server_gen.go @@ -14,12 +14,6 @@ type Handler interface { // // POST /submissions/{SubmissionID}/status/validator-failed ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error - // ActionSubmissionReleased implements actionSubmissionReleased operation. - // - // (Internal endpoint) Role Releaser changes status from releasing -> released. - // - // POST /submissions/{SubmissionID}/status/releaser-released - ActionSubmissionReleased(ctx context.Context, params ActionSubmissionReleasedParams) error // ActionSubmissionUploaded implements actionSubmissionUploaded operation. // // (Internal endpoint) Role Validator changes status from Uploading -> Uploaded. diff --git a/pkg/internal/oas_unimplemented_gen.go b/pkg/internal/oas_unimplemented_gen.go index 9228c85..c79b671 100644 --- a/pkg/internal/oas_unimplemented_gen.go +++ b/pkg/internal/oas_unimplemented_gen.go @@ -22,15 +22,6 @@ func (UnimplementedHandler) ActionSubmissionAccepted(ctx context.Context, params return ht.ErrNotImplemented } -// ActionSubmissionReleased implements actionSubmissionReleased operation. -// -// (Internal endpoint) Role Releaser changes status from releasing -> released. -// -// POST /submissions/{SubmissionID}/status/releaser-released -func (UnimplementedHandler) ActionSubmissionReleased(ctx context.Context, params ActionSubmissionReleasedParams) error { - return ht.ErrNotImplemented -} - // ActionSubmissionUploaded implements actionSubmissionUploaded operation. // // (Internal endpoint) Role Validator changes status from Uploading -> Uploaded. diff --git a/pkg/service_internal/submissions.go b/pkg/service_internal/submissions.go index 8e46735..bc04bf8 100644 --- a/pkg/service_internal/submissions.go +++ b/pkg/service_internal/submissions.go @@ -51,20 +51,6 @@ func (svc *Service) ActionSubmissionAccepted(ctx context.Context, params interna return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusValidating}, smap) } -// ActionSubmissionReleased implements actionSubmissionReleased operation. -// -// (Internal endpoint) Role Releaser changes status from Uploaded -> Released. -// -// POST /submissions/{SubmissionID}/status/releaser-released -func (svc *Service) ActionSubmissionReleased(ctx context.Context, params internal.ActionSubmissionReleasedParams) error { - println("[ActionSubmissionReleased] Implicit Validator permission granted!") - - // transaction - smap := datastore.Optional() - smap.Add("status_id", model.StatusReleased) - return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusUploaded}, smap) -} - // ActionSubmissionUploaded implements actionSubmissionUploaded operation. // // (Internal endpoint) Role Validator changes status from Uploading -> Uploaded. diff --git a/validation/api/src/internal.rs b/validation/api/src/internal.rs index f778cd9..f2d2fd9 100644 --- a/validation/api/src/internal.rs +++ b/validation/api/src/internal.rs @@ -122,5 +122,4 @@ impl Context{ } action!(action_submission_validated,"validator-validated"); action!(action_submission_accepted,"validator-failed"); - action!(action_submission_released,"releaser-released"); }