This commit is contained in:
@@ -47,6 +47,13 @@ type Invoker interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/request-changes
|
// POST /mapfixes/{MapfixID}/status/request-changes
|
||||||
ActionMapfixRequestChanges(ctx context.Context, params ActionMapfixRequestChangesParams) error
|
ActionMapfixRequestChanges(ctx context.Context, params ActionMapfixRequestChangesParams) error
|
||||||
|
// ActionMapfixResetSubmitting invokes actionMapfixResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/reset-submitting
|
||||||
|
ActionMapfixResetSubmitting(ctx context.Context, params ActionMapfixResetSubmittingParams) error
|
||||||
// ActionMapfixRetryValidate invokes actionMapfixRetryValidate operation.
|
// ActionMapfixRetryValidate invokes actionMapfixRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -59,12 +66,12 @@ type Invoker interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/revoke
|
// POST /mapfixes/{MapfixID}/status/revoke
|
||||||
ActionMapfixRevoke(ctx context.Context, params ActionMapfixRevokeParams) error
|
ActionMapfixRevoke(ctx context.Context, params ActionMapfixRevokeParams) error
|
||||||
// ActionMapfixSubmit invokes actionMapfixSubmit operation.
|
// ActionMapfixTriggerSubmit invokes actionMapfixTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/submit
|
// POST /mapfixes/{MapfixID}/status/trigger-submit
|
||||||
ActionMapfixSubmit(ctx context.Context, params ActionMapfixSubmitParams) error
|
ActionMapfixTriggerSubmit(ctx context.Context, params ActionMapfixTriggerSubmitParams) error
|
||||||
// ActionMapfixTriggerUpload invokes actionMapfixTriggerUpload operation.
|
// ActionMapfixTriggerUpload invokes actionMapfixTriggerUpload operation.
|
||||||
//
|
//
|
||||||
// Role Admin changes status from Validated -> Uploading.
|
// Role Admin changes status from Validated -> Uploading.
|
||||||
@@ -101,6 +108,13 @@ type Invoker interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/request-changes
|
// POST /submissions/{SubmissionID}/status/request-changes
|
||||||
ActionSubmissionRequestChanges(ctx context.Context, params ActionSubmissionRequestChangesParams) error
|
ActionSubmissionRequestChanges(ctx context.Context, params ActionSubmissionRequestChangesParams) error
|
||||||
|
// ActionSubmissionResetSubmitting invokes actionSubmissionResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/reset-submitting
|
||||||
|
ActionSubmissionResetSubmitting(ctx context.Context, params ActionSubmissionResetSubmittingParams) error
|
||||||
// ActionSubmissionRetryValidate invokes actionSubmissionRetryValidate operation.
|
// ActionSubmissionRetryValidate invokes actionSubmissionRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -113,12 +127,12 @@ type Invoker interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/revoke
|
// POST /submissions/{SubmissionID}/status/revoke
|
||||||
ActionSubmissionRevoke(ctx context.Context, params ActionSubmissionRevokeParams) error
|
ActionSubmissionRevoke(ctx context.Context, params ActionSubmissionRevokeParams) error
|
||||||
// ActionSubmissionSubmit invokes actionSubmissionSubmit operation.
|
// ActionSubmissionTriggerSubmit invokes actionSubmissionTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/submit
|
// POST /submissions/{SubmissionID}/status/trigger-submit
|
||||||
ActionSubmissionSubmit(ctx context.Context, params ActionSubmissionSubmitParams) error
|
ActionSubmissionTriggerSubmit(ctx context.Context, params ActionSubmissionTriggerSubmitParams) error
|
||||||
// ActionSubmissionTriggerUpload invokes actionSubmissionTriggerUpload operation.
|
// ActionSubmissionTriggerUpload invokes actionSubmissionTriggerUpload operation.
|
||||||
//
|
//
|
||||||
// Role Admin changes status from Validated -> Uploading.
|
// Role Admin changes status from Validated -> Uploading.
|
||||||
@@ -746,6 +760,131 @@ func (c *Client) sendActionMapfixRequestChanges(ctx context.Context, params Acti
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionMapfixResetSubmitting invokes actionMapfixResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/reset-submitting
|
||||||
|
func (c *Client) ActionMapfixResetSubmitting(ctx context.Context, params ActionMapfixResetSubmittingParams) error {
|
||||||
|
_, err := c.sendActionMapfixResetSubmitting(ctx, params)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) sendActionMapfixResetSubmitting(ctx context.Context, params ActionMapfixResetSubmittingParams) (res *ActionMapfixResetSubmittingNoContent, err error) {
|
||||||
|
otelAttrs := []attribute.KeyValue{
|
||||||
|
otelogen.OperationID("actionMapfixResetSubmitting"),
|
||||||
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
|
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/reset-submitting"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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, ActionMapfixResetSubmittingOperation,
|
||||||
|
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] = "/mapfixes/"
|
||||||
|
{
|
||||||
|
// Encode "MapfixID" parameter.
|
||||||
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
||||||
|
Param: "MapfixID",
|
||||||
|
Style: uri.PathStyleSimple,
|
||||||
|
Explode: false,
|
||||||
|
})
|
||||||
|
if err := func() error {
|
||||||
|
return e.EncodeValue(conv.Int64ToString(params.MapfixID))
|
||||||
|
}(); 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/reset-submitting"
|
||||||
|
uri.AddPathParts(u, pathParts[:]...)
|
||||||
|
|
||||||
|
stage = "EncodeRequest"
|
||||||
|
r, err := ht.NewRequest(ctx, "POST", u)
|
||||||
|
if err != nil {
|
||||||
|
return res, errors.Wrap(err, "create request")
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
type bitset = [1]uint8
|
||||||
|
var satisfied bitset
|
||||||
|
{
|
||||||
|
stage = "Security:CookieAuth"
|
||||||
|
switch err := c.securityCookieAuth(ctx, ActionMapfixResetSubmittingOperation, r); {
|
||||||
|
case err == nil: // if NO error
|
||||||
|
satisfied[0] |= 1 << 0
|
||||||
|
case errors.Is(err, ogenerrors.ErrSkipClientSecurity):
|
||||||
|
// Skip this security.
|
||||||
|
default:
|
||||||
|
return res, errors.Wrap(err, "security \"CookieAuth\"")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ok := func() bool {
|
||||||
|
nextRequirement:
|
||||||
|
for _, requirement := range []bitset{
|
||||||
|
{0b00000001},
|
||||||
|
} {
|
||||||
|
for i, mask := range requirement {
|
||||||
|
if satisfied[i]&mask != mask {
|
||||||
|
continue nextRequirement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}(); !ok {
|
||||||
|
return res, ogenerrors.ErrSecurityRequirementIsNotSatisfied
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 := decodeActionMapfixResetSubmittingResponse(resp)
|
||||||
|
if err != nil {
|
||||||
|
return res, errors.Wrap(err, "decode response")
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ActionMapfixRetryValidate invokes actionMapfixRetryValidate operation.
|
// ActionMapfixRetryValidate invokes actionMapfixRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -994,21 +1133,21 @@ func (c *Client) sendActionMapfixRevoke(ctx context.Context, params ActionMapfix
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixSubmit invokes actionMapfixSubmit operation.
|
// ActionMapfixTriggerSubmit invokes actionMapfixTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/submit
|
// POST /mapfixes/{MapfixID}/status/trigger-submit
|
||||||
func (c *Client) ActionMapfixSubmit(ctx context.Context, params ActionMapfixSubmitParams) error {
|
func (c *Client) ActionMapfixTriggerSubmit(ctx context.Context, params ActionMapfixTriggerSubmitParams) error {
|
||||||
_, err := c.sendActionMapfixSubmit(ctx, params)
|
_, err := c.sendActionMapfixTriggerSubmit(ctx, params)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) sendActionMapfixSubmit(ctx context.Context, params ActionMapfixSubmitParams) (res *ActionMapfixSubmitNoContent, err error) {
|
func (c *Client) sendActionMapfixTriggerSubmit(ctx context.Context, params ActionMapfixTriggerSubmitParams) (res *ActionMapfixTriggerSubmitNoContent, err error) {
|
||||||
otelAttrs := []attribute.KeyValue{
|
otelAttrs := []attribute.KeyValue{
|
||||||
otelogen.OperationID("actionMapfixSubmit"),
|
otelogen.OperationID("actionMapfixTriggerSubmit"),
|
||||||
semconv.HTTPRequestMethodKey.String("POST"),
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/submit"),
|
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/trigger-submit"),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run stopwatch.
|
// Run stopwatch.
|
||||||
@@ -1023,7 +1162,7 @@ func (c *Client) sendActionMapfixSubmit(ctx context.Context, params ActionMapfix
|
|||||||
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
|
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
|
||||||
|
|
||||||
// Start a span for this request.
|
// Start a span for this request.
|
||||||
ctx, span := c.cfg.Tracer.Start(ctx, ActionMapfixSubmitOperation,
|
ctx, span := c.cfg.Tracer.Start(ctx, ActionMapfixTriggerSubmitOperation,
|
||||||
trace.WithAttributes(otelAttrs...),
|
trace.WithAttributes(otelAttrs...),
|
||||||
clientSpanKind,
|
clientSpanKind,
|
||||||
)
|
)
|
||||||
@@ -1060,7 +1199,7 @@ func (c *Client) sendActionMapfixSubmit(ctx context.Context, params ActionMapfix
|
|||||||
}
|
}
|
||||||
pathParts[1] = encoded
|
pathParts[1] = encoded
|
||||||
}
|
}
|
||||||
pathParts[2] = "/status/submit"
|
pathParts[2] = "/status/trigger-submit"
|
||||||
uri.AddPathParts(u, pathParts[:]...)
|
uri.AddPathParts(u, pathParts[:]...)
|
||||||
|
|
||||||
stage = "EncodeRequest"
|
stage = "EncodeRequest"
|
||||||
@@ -1074,7 +1213,7 @@ func (c *Client) sendActionMapfixSubmit(ctx context.Context, params ActionMapfix
|
|||||||
var satisfied bitset
|
var satisfied bitset
|
||||||
{
|
{
|
||||||
stage = "Security:CookieAuth"
|
stage = "Security:CookieAuth"
|
||||||
switch err := c.securityCookieAuth(ctx, ActionMapfixSubmitOperation, r); {
|
switch err := c.securityCookieAuth(ctx, ActionMapfixTriggerSubmitOperation, r); {
|
||||||
case err == nil: // if NO error
|
case err == nil: // if NO error
|
||||||
satisfied[0] |= 1 << 0
|
satisfied[0] |= 1 << 0
|
||||||
case errors.Is(err, ogenerrors.ErrSkipClientSecurity):
|
case errors.Is(err, ogenerrors.ErrSkipClientSecurity):
|
||||||
@@ -1110,7 +1249,7 @@ func (c *Client) sendActionMapfixSubmit(ctx context.Context, params ActionMapfix
|
|||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
stage = "DecodeResponse"
|
stage = "DecodeResponse"
|
||||||
result, err := decodeActionMapfixSubmitResponse(resp)
|
result, err := decodeActionMapfixTriggerSubmitResponse(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, errors.Wrap(err, "decode response")
|
return res, errors.Wrap(err, "decode response")
|
||||||
}
|
}
|
||||||
@@ -1862,6 +2001,131 @@ func (c *Client) sendActionSubmissionRequestChanges(ctx context.Context, params
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionSubmissionResetSubmitting invokes actionSubmissionResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/reset-submitting
|
||||||
|
func (c *Client) ActionSubmissionResetSubmitting(ctx context.Context, params ActionSubmissionResetSubmittingParams) error {
|
||||||
|
_, err := c.sendActionSubmissionResetSubmitting(ctx, params)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) sendActionSubmissionResetSubmitting(ctx context.Context, params ActionSubmissionResetSubmittingParams) (res *ActionSubmissionResetSubmittingNoContent, err error) {
|
||||||
|
otelAttrs := []attribute.KeyValue{
|
||||||
|
otelogen.OperationID("actionSubmissionResetSubmitting"),
|
||||||
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
|
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/reset-submitting"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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, ActionSubmissionResetSubmittingOperation,
|
||||||
|
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/reset-submitting"
|
||||||
|
uri.AddPathParts(u, pathParts[:]...)
|
||||||
|
|
||||||
|
stage = "EncodeRequest"
|
||||||
|
r, err := ht.NewRequest(ctx, "POST", u)
|
||||||
|
if err != nil {
|
||||||
|
return res, errors.Wrap(err, "create request")
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
type bitset = [1]uint8
|
||||||
|
var satisfied bitset
|
||||||
|
{
|
||||||
|
stage = "Security:CookieAuth"
|
||||||
|
switch err := c.securityCookieAuth(ctx, ActionSubmissionResetSubmittingOperation, r); {
|
||||||
|
case err == nil: // if NO error
|
||||||
|
satisfied[0] |= 1 << 0
|
||||||
|
case errors.Is(err, ogenerrors.ErrSkipClientSecurity):
|
||||||
|
// Skip this security.
|
||||||
|
default:
|
||||||
|
return res, errors.Wrap(err, "security \"CookieAuth\"")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ok := func() bool {
|
||||||
|
nextRequirement:
|
||||||
|
for _, requirement := range []bitset{
|
||||||
|
{0b00000001},
|
||||||
|
} {
|
||||||
|
for i, mask := range requirement {
|
||||||
|
if satisfied[i]&mask != mask {
|
||||||
|
continue nextRequirement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}(); !ok {
|
||||||
|
return res, ogenerrors.ErrSecurityRequirementIsNotSatisfied
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 := decodeActionSubmissionResetSubmittingResponse(resp)
|
||||||
|
if err != nil {
|
||||||
|
return res, errors.Wrap(err, "decode response")
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ActionSubmissionRetryValidate invokes actionSubmissionRetryValidate operation.
|
// ActionSubmissionRetryValidate invokes actionSubmissionRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -2110,21 +2374,21 @@ func (c *Client) sendActionSubmissionRevoke(ctx context.Context, params ActionSu
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionSubmit invokes actionSubmissionSubmit operation.
|
// ActionSubmissionTriggerSubmit invokes actionSubmissionTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/submit
|
// POST /submissions/{SubmissionID}/status/trigger-submit
|
||||||
func (c *Client) ActionSubmissionSubmit(ctx context.Context, params ActionSubmissionSubmitParams) error {
|
func (c *Client) ActionSubmissionTriggerSubmit(ctx context.Context, params ActionSubmissionTriggerSubmitParams) error {
|
||||||
_, err := c.sendActionSubmissionSubmit(ctx, params)
|
_, err := c.sendActionSubmissionTriggerSubmit(ctx, params)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) sendActionSubmissionSubmit(ctx context.Context, params ActionSubmissionSubmitParams) (res *ActionSubmissionSubmitNoContent, err error) {
|
func (c *Client) sendActionSubmissionTriggerSubmit(ctx context.Context, params ActionSubmissionTriggerSubmitParams) (res *ActionSubmissionTriggerSubmitNoContent, err error) {
|
||||||
otelAttrs := []attribute.KeyValue{
|
otelAttrs := []attribute.KeyValue{
|
||||||
otelogen.OperationID("actionSubmissionSubmit"),
|
otelogen.OperationID("actionSubmissionTriggerSubmit"),
|
||||||
semconv.HTTPRequestMethodKey.String("POST"),
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/submit"),
|
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/trigger-submit"),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run stopwatch.
|
// Run stopwatch.
|
||||||
@@ -2139,7 +2403,7 @@ func (c *Client) sendActionSubmissionSubmit(ctx context.Context, params ActionSu
|
|||||||
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
|
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
|
||||||
|
|
||||||
// Start a span for this request.
|
// Start a span for this request.
|
||||||
ctx, span := c.cfg.Tracer.Start(ctx, ActionSubmissionSubmitOperation,
|
ctx, span := c.cfg.Tracer.Start(ctx, ActionSubmissionTriggerSubmitOperation,
|
||||||
trace.WithAttributes(otelAttrs...),
|
trace.WithAttributes(otelAttrs...),
|
||||||
clientSpanKind,
|
clientSpanKind,
|
||||||
)
|
)
|
||||||
@@ -2176,7 +2440,7 @@ func (c *Client) sendActionSubmissionSubmit(ctx context.Context, params ActionSu
|
|||||||
}
|
}
|
||||||
pathParts[1] = encoded
|
pathParts[1] = encoded
|
||||||
}
|
}
|
||||||
pathParts[2] = "/status/submit"
|
pathParts[2] = "/status/trigger-submit"
|
||||||
uri.AddPathParts(u, pathParts[:]...)
|
uri.AddPathParts(u, pathParts[:]...)
|
||||||
|
|
||||||
stage = "EncodeRequest"
|
stage = "EncodeRequest"
|
||||||
@@ -2190,7 +2454,7 @@ func (c *Client) sendActionSubmissionSubmit(ctx context.Context, params ActionSu
|
|||||||
var satisfied bitset
|
var satisfied bitset
|
||||||
{
|
{
|
||||||
stage = "Security:CookieAuth"
|
stage = "Security:CookieAuth"
|
||||||
switch err := c.securityCookieAuth(ctx, ActionSubmissionSubmitOperation, r); {
|
switch err := c.securityCookieAuth(ctx, ActionSubmissionTriggerSubmitOperation, r); {
|
||||||
case err == nil: // if NO error
|
case err == nil: // if NO error
|
||||||
satisfied[0] |= 1 << 0
|
satisfied[0] |= 1 << 0
|
||||||
case errors.Is(err, ogenerrors.ErrSkipClientSecurity):
|
case errors.Is(err, ogenerrors.ErrSkipClientSecurity):
|
||||||
@@ -2226,7 +2490,7 @@ func (c *Client) sendActionSubmissionSubmit(ctx context.Context, params ActionSu
|
|||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
stage = "DecodeResponse"
|
stage = "DecodeResponse"
|
||||||
result, err := decodeActionSubmissionSubmitResponse(resp)
|
result, err := decodeActionSubmissionTriggerSubmitResponse(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, errors.Wrap(err, "decode response")
|
return res, errors.Wrap(err, "decode response")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -615,6 +615,202 @@ func (s *Server) handleActionMapfixRequestChangesRequest(args [1]string, argsEsc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handleActionMapfixResetSubmittingRequest handles actionMapfixResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/reset-submitting
|
||||||
|
func (s *Server) handleActionMapfixResetSubmittingRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||||
|
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||||
|
w = statusWriter
|
||||||
|
otelAttrs := []attribute.KeyValue{
|
||||||
|
otelogen.OperationID("actionMapfixResetSubmitting"),
|
||||||
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
|
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/reset-submitting"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start a span for this request.
|
||||||
|
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionMapfixResetSubmittingOperation,
|
||||||
|
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: ActionMapfixResetSubmittingOperation,
|
||||||
|
ID: "actionMapfixResetSubmitting",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
type bitset = [1]uint8
|
||||||
|
var satisfied bitset
|
||||||
|
{
|
||||||
|
sctx, ok, err := s.securityCookieAuth(ctx, ActionMapfixResetSubmittingOperation, r)
|
||||||
|
if err != nil {
|
||||||
|
err = &ogenerrors.SecurityError{
|
||||||
|
OperationContext: opErrContext,
|
||||||
|
Security: "CookieAuth",
|
||||||
|
Err: err,
|
||||||
|
}
|
||||||
|
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||||
|
defer recordError("Security:CookieAuth", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ok {
|
||||||
|
satisfied[0] |= 1 << 0
|
||||||
|
ctx = sctx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ok := func() bool {
|
||||||
|
nextRequirement:
|
||||||
|
for _, requirement := range []bitset{
|
||||||
|
{0b00000001},
|
||||||
|
} {
|
||||||
|
for i, mask := range requirement {
|
||||||
|
if satisfied[i]&mask != mask {
|
||||||
|
continue nextRequirement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}(); !ok {
|
||||||
|
err = &ogenerrors.SecurityError{
|
||||||
|
OperationContext: opErrContext,
|
||||||
|
Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied,
|
||||||
|
}
|
||||||
|
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||||
|
defer recordError("Security", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
params, err := decodeActionMapfixResetSubmittingParams(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 *ActionMapfixResetSubmittingNoContent
|
||||||
|
if m := s.cfg.Middleware; m != nil {
|
||||||
|
mreq := middleware.Request{
|
||||||
|
Context: ctx,
|
||||||
|
OperationName: ActionMapfixResetSubmittingOperation,
|
||||||
|
OperationSummary: "Role Submitter manually resets submitting softlock and changes status from Submitting -> UnderConstruction",
|
||||||
|
OperationID: "actionMapfixResetSubmitting",
|
||||||
|
Body: nil,
|
||||||
|
Params: middleware.Parameters{
|
||||||
|
{
|
||||||
|
Name: "MapfixID",
|
||||||
|
In: "path",
|
||||||
|
}: params.MapfixID,
|
||||||
|
},
|
||||||
|
Raw: r,
|
||||||
|
}
|
||||||
|
|
||||||
|
type (
|
||||||
|
Request = struct{}
|
||||||
|
Params = ActionMapfixResetSubmittingParams
|
||||||
|
Response = *ActionMapfixResetSubmittingNoContent
|
||||||
|
)
|
||||||
|
response, err = middleware.HookMiddleware[
|
||||||
|
Request,
|
||||||
|
Params,
|
||||||
|
Response,
|
||||||
|
](
|
||||||
|
m,
|
||||||
|
mreq,
|
||||||
|
unpackActionMapfixResetSubmittingParams,
|
||||||
|
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||||
|
err = s.h.ActionMapfixResetSubmitting(ctx, params)
|
||||||
|
return response, err
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
err = s.h.ActionMapfixResetSubmitting(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 := encodeActionMapfixResetSubmittingResponse(response, w, span); err != nil {
|
||||||
|
defer recordError("EncodeResponse", err)
|
||||||
|
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||||
|
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// handleActionMapfixRetryValidateRequest handles actionMapfixRetryValidate operation.
|
// handleActionMapfixRetryValidateRequest handles actionMapfixRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -1005,22 +1201,22 @@ func (s *Server) handleActionMapfixRevokeRequest(args [1]string, argsEscaped boo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleActionMapfixSubmitRequest handles actionMapfixSubmit operation.
|
// handleActionMapfixTriggerSubmitRequest handles actionMapfixTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/submit
|
// POST /mapfixes/{MapfixID}/status/trigger-submit
|
||||||
func (s *Server) handleActionMapfixSubmitRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
func (s *Server) handleActionMapfixTriggerSubmitRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||||
w = statusWriter
|
w = statusWriter
|
||||||
otelAttrs := []attribute.KeyValue{
|
otelAttrs := []attribute.KeyValue{
|
||||||
otelogen.OperationID("actionMapfixSubmit"),
|
otelogen.OperationID("actionMapfixTriggerSubmit"),
|
||||||
semconv.HTTPRequestMethodKey.String("POST"),
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/submit"),
|
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/trigger-submit"),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a span for this request.
|
// Start a span for this request.
|
||||||
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionMapfixSubmitOperation,
|
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionMapfixTriggerSubmitOperation,
|
||||||
trace.WithAttributes(otelAttrs...),
|
trace.WithAttributes(otelAttrs...),
|
||||||
serverSpanKind,
|
serverSpanKind,
|
||||||
)
|
)
|
||||||
@@ -1075,15 +1271,15 @@ func (s *Server) handleActionMapfixSubmitRequest(args [1]string, argsEscaped boo
|
|||||||
}
|
}
|
||||||
err error
|
err error
|
||||||
opErrContext = ogenerrors.OperationContext{
|
opErrContext = ogenerrors.OperationContext{
|
||||||
Name: ActionMapfixSubmitOperation,
|
Name: ActionMapfixTriggerSubmitOperation,
|
||||||
ID: "actionMapfixSubmit",
|
ID: "actionMapfixTriggerSubmit",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
type bitset = [1]uint8
|
type bitset = [1]uint8
|
||||||
var satisfied bitset
|
var satisfied bitset
|
||||||
{
|
{
|
||||||
sctx, ok, err := s.securityCookieAuth(ctx, ActionMapfixSubmitOperation, r)
|
sctx, ok, err := s.securityCookieAuth(ctx, ActionMapfixTriggerSubmitOperation, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = &ogenerrors.SecurityError{
|
err = &ogenerrors.SecurityError{
|
||||||
OperationContext: opErrContext,
|
OperationContext: opErrContext,
|
||||||
@@ -1125,7 +1321,7 @@ func (s *Server) handleActionMapfixSubmitRequest(args [1]string, argsEscaped boo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params, err := decodeActionMapfixSubmitParams(args, argsEscaped, r)
|
params, err := decodeActionMapfixTriggerSubmitParams(args, argsEscaped, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = &ogenerrors.DecodeParamsError{
|
err = &ogenerrors.DecodeParamsError{
|
||||||
OperationContext: opErrContext,
|
OperationContext: opErrContext,
|
||||||
@@ -1136,13 +1332,13 @@ func (s *Server) handleActionMapfixSubmitRequest(args [1]string, argsEscaped boo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var response *ActionMapfixSubmitNoContent
|
var response *ActionMapfixTriggerSubmitNoContent
|
||||||
if m := s.cfg.Middleware; m != nil {
|
if m := s.cfg.Middleware; m != nil {
|
||||||
mreq := middleware.Request{
|
mreq := middleware.Request{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
OperationName: ActionMapfixSubmitOperation,
|
OperationName: ActionMapfixTriggerSubmitOperation,
|
||||||
OperationSummary: "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted",
|
OperationSummary: "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting",
|
||||||
OperationID: "actionMapfixSubmit",
|
OperationID: "actionMapfixTriggerSubmit",
|
||||||
Body: nil,
|
Body: nil,
|
||||||
Params: middleware.Parameters{
|
Params: middleware.Parameters{
|
||||||
{
|
{
|
||||||
@@ -1155,8 +1351,8 @@ func (s *Server) handleActionMapfixSubmitRequest(args [1]string, argsEscaped boo
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
Request = struct{}
|
Request = struct{}
|
||||||
Params = ActionMapfixSubmitParams
|
Params = ActionMapfixTriggerSubmitParams
|
||||||
Response = *ActionMapfixSubmitNoContent
|
Response = *ActionMapfixTriggerSubmitNoContent
|
||||||
)
|
)
|
||||||
response, err = middleware.HookMiddleware[
|
response, err = middleware.HookMiddleware[
|
||||||
Request,
|
Request,
|
||||||
@@ -1165,14 +1361,14 @@ func (s *Server) handleActionMapfixSubmitRequest(args [1]string, argsEscaped boo
|
|||||||
](
|
](
|
||||||
m,
|
m,
|
||||||
mreq,
|
mreq,
|
||||||
unpackActionMapfixSubmitParams,
|
unpackActionMapfixTriggerSubmitParams,
|
||||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||||
err = s.h.ActionMapfixSubmit(ctx, params)
|
err = s.h.ActionMapfixTriggerSubmit(ctx, params)
|
||||||
return response, err
|
return response, err
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
err = s.h.ActionMapfixSubmit(ctx, params)
|
err = s.h.ActionMapfixTriggerSubmit(ctx, params)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errRes, ok := errors.Into[*ErrorStatusCode](err); ok {
|
if errRes, ok := errors.Into[*ErrorStatusCode](err); ok {
|
||||||
@@ -1191,7 +1387,7 @@ func (s *Server) handleActionMapfixSubmitRequest(args [1]string, argsEscaped boo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := encodeActionMapfixSubmitResponse(response, w, span); err != nil {
|
if err := encodeActionMapfixTriggerSubmitResponse(response, w, span); err != nil {
|
||||||
defer recordError("EncodeResponse", err)
|
defer recordError("EncodeResponse", err)
|
||||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||||
@@ -2370,6 +2566,202 @@ func (s *Server) handleActionSubmissionRequestChangesRequest(args [1]string, arg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handleActionSubmissionResetSubmittingRequest handles actionSubmissionResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/reset-submitting
|
||||||
|
func (s *Server) handleActionSubmissionResetSubmittingRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||||
|
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||||
|
w = statusWriter
|
||||||
|
otelAttrs := []attribute.KeyValue{
|
||||||
|
otelogen.OperationID("actionSubmissionResetSubmitting"),
|
||||||
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
|
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/reset-submitting"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start a span for this request.
|
||||||
|
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionSubmissionResetSubmittingOperation,
|
||||||
|
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: ActionSubmissionResetSubmittingOperation,
|
||||||
|
ID: "actionSubmissionResetSubmitting",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
type bitset = [1]uint8
|
||||||
|
var satisfied bitset
|
||||||
|
{
|
||||||
|
sctx, ok, err := s.securityCookieAuth(ctx, ActionSubmissionResetSubmittingOperation, r)
|
||||||
|
if err != nil {
|
||||||
|
err = &ogenerrors.SecurityError{
|
||||||
|
OperationContext: opErrContext,
|
||||||
|
Security: "CookieAuth",
|
||||||
|
Err: err,
|
||||||
|
}
|
||||||
|
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||||
|
defer recordError("Security:CookieAuth", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ok {
|
||||||
|
satisfied[0] |= 1 << 0
|
||||||
|
ctx = sctx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ok := func() bool {
|
||||||
|
nextRequirement:
|
||||||
|
for _, requirement := range []bitset{
|
||||||
|
{0b00000001},
|
||||||
|
} {
|
||||||
|
for i, mask := range requirement {
|
||||||
|
if satisfied[i]&mask != mask {
|
||||||
|
continue nextRequirement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}(); !ok {
|
||||||
|
err = &ogenerrors.SecurityError{
|
||||||
|
OperationContext: opErrContext,
|
||||||
|
Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied,
|
||||||
|
}
|
||||||
|
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||||
|
defer recordError("Security", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
params, err := decodeActionSubmissionResetSubmittingParams(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 *ActionSubmissionResetSubmittingNoContent
|
||||||
|
if m := s.cfg.Middleware; m != nil {
|
||||||
|
mreq := middleware.Request{
|
||||||
|
Context: ctx,
|
||||||
|
OperationName: ActionSubmissionResetSubmittingOperation,
|
||||||
|
OperationSummary: "Role Submitter manually resets submitting softlock and changes status from Submitting -> UnderConstruction",
|
||||||
|
OperationID: "actionSubmissionResetSubmitting",
|
||||||
|
Body: nil,
|
||||||
|
Params: middleware.Parameters{
|
||||||
|
{
|
||||||
|
Name: "SubmissionID",
|
||||||
|
In: "path",
|
||||||
|
}: params.SubmissionID,
|
||||||
|
},
|
||||||
|
Raw: r,
|
||||||
|
}
|
||||||
|
|
||||||
|
type (
|
||||||
|
Request = struct{}
|
||||||
|
Params = ActionSubmissionResetSubmittingParams
|
||||||
|
Response = *ActionSubmissionResetSubmittingNoContent
|
||||||
|
)
|
||||||
|
response, err = middleware.HookMiddleware[
|
||||||
|
Request,
|
||||||
|
Params,
|
||||||
|
Response,
|
||||||
|
](
|
||||||
|
m,
|
||||||
|
mreq,
|
||||||
|
unpackActionSubmissionResetSubmittingParams,
|
||||||
|
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||||
|
err = s.h.ActionSubmissionResetSubmitting(ctx, params)
|
||||||
|
return response, err
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
err = s.h.ActionSubmissionResetSubmitting(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 := encodeActionSubmissionResetSubmittingResponse(response, w, span); err != nil {
|
||||||
|
defer recordError("EncodeResponse", err)
|
||||||
|
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||||
|
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// handleActionSubmissionRetryValidateRequest handles actionSubmissionRetryValidate operation.
|
// handleActionSubmissionRetryValidateRequest handles actionSubmissionRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -2760,22 +3152,22 @@ func (s *Server) handleActionSubmissionRevokeRequest(args [1]string, argsEscaped
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleActionSubmissionSubmitRequest handles actionSubmissionSubmit operation.
|
// handleActionSubmissionTriggerSubmitRequest handles actionSubmissionTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/submit
|
// POST /submissions/{SubmissionID}/status/trigger-submit
|
||||||
func (s *Server) handleActionSubmissionSubmitRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
func (s *Server) handleActionSubmissionTriggerSubmitRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||||
w = statusWriter
|
w = statusWriter
|
||||||
otelAttrs := []attribute.KeyValue{
|
otelAttrs := []attribute.KeyValue{
|
||||||
otelogen.OperationID("actionSubmissionSubmit"),
|
otelogen.OperationID("actionSubmissionTriggerSubmit"),
|
||||||
semconv.HTTPRequestMethodKey.String("POST"),
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/submit"),
|
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/trigger-submit"),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a span for this request.
|
// Start a span for this request.
|
||||||
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionSubmissionSubmitOperation,
|
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionSubmissionTriggerSubmitOperation,
|
||||||
trace.WithAttributes(otelAttrs...),
|
trace.WithAttributes(otelAttrs...),
|
||||||
serverSpanKind,
|
serverSpanKind,
|
||||||
)
|
)
|
||||||
@@ -2830,15 +3222,15 @@ func (s *Server) handleActionSubmissionSubmitRequest(args [1]string, argsEscaped
|
|||||||
}
|
}
|
||||||
err error
|
err error
|
||||||
opErrContext = ogenerrors.OperationContext{
|
opErrContext = ogenerrors.OperationContext{
|
||||||
Name: ActionSubmissionSubmitOperation,
|
Name: ActionSubmissionTriggerSubmitOperation,
|
||||||
ID: "actionSubmissionSubmit",
|
ID: "actionSubmissionTriggerSubmit",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
type bitset = [1]uint8
|
type bitset = [1]uint8
|
||||||
var satisfied bitset
|
var satisfied bitset
|
||||||
{
|
{
|
||||||
sctx, ok, err := s.securityCookieAuth(ctx, ActionSubmissionSubmitOperation, r)
|
sctx, ok, err := s.securityCookieAuth(ctx, ActionSubmissionTriggerSubmitOperation, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = &ogenerrors.SecurityError{
|
err = &ogenerrors.SecurityError{
|
||||||
OperationContext: opErrContext,
|
OperationContext: opErrContext,
|
||||||
@@ -2880,7 +3272,7 @@ func (s *Server) handleActionSubmissionSubmitRequest(args [1]string, argsEscaped
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params, err := decodeActionSubmissionSubmitParams(args, argsEscaped, r)
|
params, err := decodeActionSubmissionTriggerSubmitParams(args, argsEscaped, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = &ogenerrors.DecodeParamsError{
|
err = &ogenerrors.DecodeParamsError{
|
||||||
OperationContext: opErrContext,
|
OperationContext: opErrContext,
|
||||||
@@ -2891,13 +3283,13 @@ func (s *Server) handleActionSubmissionSubmitRequest(args [1]string, argsEscaped
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var response *ActionSubmissionSubmitNoContent
|
var response *ActionSubmissionTriggerSubmitNoContent
|
||||||
if m := s.cfg.Middleware; m != nil {
|
if m := s.cfg.Middleware; m != nil {
|
||||||
mreq := middleware.Request{
|
mreq := middleware.Request{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
OperationName: ActionSubmissionSubmitOperation,
|
OperationName: ActionSubmissionTriggerSubmitOperation,
|
||||||
OperationSummary: "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted",
|
OperationSummary: "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting",
|
||||||
OperationID: "actionSubmissionSubmit",
|
OperationID: "actionSubmissionTriggerSubmit",
|
||||||
Body: nil,
|
Body: nil,
|
||||||
Params: middleware.Parameters{
|
Params: middleware.Parameters{
|
||||||
{
|
{
|
||||||
@@ -2910,8 +3302,8 @@ func (s *Server) handleActionSubmissionSubmitRequest(args [1]string, argsEscaped
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
Request = struct{}
|
Request = struct{}
|
||||||
Params = ActionSubmissionSubmitParams
|
Params = ActionSubmissionTriggerSubmitParams
|
||||||
Response = *ActionSubmissionSubmitNoContent
|
Response = *ActionSubmissionTriggerSubmitNoContent
|
||||||
)
|
)
|
||||||
response, err = middleware.HookMiddleware[
|
response, err = middleware.HookMiddleware[
|
||||||
Request,
|
Request,
|
||||||
@@ -2920,14 +3312,14 @@ func (s *Server) handleActionSubmissionSubmitRequest(args [1]string, argsEscaped
|
|||||||
](
|
](
|
||||||
m,
|
m,
|
||||||
mreq,
|
mreq,
|
||||||
unpackActionSubmissionSubmitParams,
|
unpackActionSubmissionTriggerSubmitParams,
|
||||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||||
err = s.h.ActionSubmissionSubmit(ctx, params)
|
err = s.h.ActionSubmissionTriggerSubmit(ctx, params)
|
||||||
return response, err
|
return response, err
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
err = s.h.ActionSubmissionSubmit(ctx, params)
|
err = s.h.ActionSubmissionTriggerSubmit(ctx, params)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errRes, ok := errors.Into[*ErrorStatusCode](err); ok {
|
if errRes, ok := errors.Into[*ErrorStatusCode](err); ok {
|
||||||
@@ -2946,7 +3338,7 @@ func (s *Server) handleActionSubmissionSubmitRequest(args [1]string, argsEscaped
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := encodeActionSubmissionSubmitResponse(response, w, span); err != nil {
|
if err := encodeActionSubmissionTriggerSubmitResponse(response, w, span); err != nil {
|
||||||
defer recordError("EncodeResponse", err)
|
defer recordError("EncodeResponse", err)
|
||||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||||
|
|||||||
@@ -9,18 +9,20 @@ const (
|
|||||||
ActionMapfixAcceptedOperation OperationName = "ActionMapfixAccepted"
|
ActionMapfixAcceptedOperation OperationName = "ActionMapfixAccepted"
|
||||||
ActionMapfixRejectOperation OperationName = "ActionMapfixReject"
|
ActionMapfixRejectOperation OperationName = "ActionMapfixReject"
|
||||||
ActionMapfixRequestChangesOperation OperationName = "ActionMapfixRequestChanges"
|
ActionMapfixRequestChangesOperation OperationName = "ActionMapfixRequestChanges"
|
||||||
|
ActionMapfixResetSubmittingOperation OperationName = "ActionMapfixResetSubmitting"
|
||||||
ActionMapfixRetryValidateOperation OperationName = "ActionMapfixRetryValidate"
|
ActionMapfixRetryValidateOperation OperationName = "ActionMapfixRetryValidate"
|
||||||
ActionMapfixRevokeOperation OperationName = "ActionMapfixRevoke"
|
ActionMapfixRevokeOperation OperationName = "ActionMapfixRevoke"
|
||||||
ActionMapfixSubmitOperation OperationName = "ActionMapfixSubmit"
|
ActionMapfixTriggerSubmitOperation OperationName = "ActionMapfixTriggerSubmit"
|
||||||
ActionMapfixTriggerUploadOperation OperationName = "ActionMapfixTriggerUpload"
|
ActionMapfixTriggerUploadOperation OperationName = "ActionMapfixTriggerUpload"
|
||||||
ActionMapfixTriggerValidateOperation OperationName = "ActionMapfixTriggerValidate"
|
ActionMapfixTriggerValidateOperation OperationName = "ActionMapfixTriggerValidate"
|
||||||
ActionMapfixValidatedOperation OperationName = "ActionMapfixValidated"
|
ActionMapfixValidatedOperation OperationName = "ActionMapfixValidated"
|
||||||
ActionSubmissionAcceptedOperation OperationName = "ActionSubmissionAccepted"
|
ActionSubmissionAcceptedOperation OperationName = "ActionSubmissionAccepted"
|
||||||
ActionSubmissionRejectOperation OperationName = "ActionSubmissionReject"
|
ActionSubmissionRejectOperation OperationName = "ActionSubmissionReject"
|
||||||
ActionSubmissionRequestChangesOperation OperationName = "ActionSubmissionRequestChanges"
|
ActionSubmissionRequestChangesOperation OperationName = "ActionSubmissionRequestChanges"
|
||||||
|
ActionSubmissionResetSubmittingOperation OperationName = "ActionSubmissionResetSubmitting"
|
||||||
ActionSubmissionRetryValidateOperation OperationName = "ActionSubmissionRetryValidate"
|
ActionSubmissionRetryValidateOperation OperationName = "ActionSubmissionRetryValidate"
|
||||||
ActionSubmissionRevokeOperation OperationName = "ActionSubmissionRevoke"
|
ActionSubmissionRevokeOperation OperationName = "ActionSubmissionRevoke"
|
||||||
ActionSubmissionSubmitOperation OperationName = "ActionSubmissionSubmit"
|
ActionSubmissionTriggerSubmitOperation OperationName = "ActionSubmissionTriggerSubmit"
|
||||||
ActionSubmissionTriggerUploadOperation OperationName = "ActionSubmissionTriggerUpload"
|
ActionSubmissionTriggerUploadOperation OperationName = "ActionSubmissionTriggerUpload"
|
||||||
ActionSubmissionTriggerValidateOperation OperationName = "ActionSubmissionTriggerValidate"
|
ActionSubmissionTriggerValidateOperation OperationName = "ActionSubmissionTriggerValidate"
|
||||||
ActionSubmissionValidatedOperation OperationName = "ActionSubmissionValidated"
|
ActionSubmissionValidatedOperation OperationName = "ActionSubmissionValidated"
|
||||||
|
|||||||
@@ -264,6 +264,89 @@ func decodeActionMapfixRequestChangesParams(args [1]string, argsEscaped bool, r
|
|||||||
return params, nil
|
return params, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionMapfixResetSubmittingParams is parameters of actionMapfixResetSubmitting operation.
|
||||||
|
type ActionMapfixResetSubmittingParams struct {
|
||||||
|
// The unique identifier for a mapfix.
|
||||||
|
MapfixID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func unpackActionMapfixResetSubmittingParams(packed middleware.Parameters) (params ActionMapfixResetSubmittingParams) {
|
||||||
|
{
|
||||||
|
key := middleware.ParameterKey{
|
||||||
|
Name: "MapfixID",
|
||||||
|
In: "path",
|
||||||
|
}
|
||||||
|
params.MapfixID = packed[key].(int64)
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|
||||||
|
func decodeActionMapfixResetSubmittingParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionMapfixResetSubmittingParams, _ error) {
|
||||||
|
// Decode path: MapfixID.
|
||||||
|
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: "MapfixID",
|
||||||
|
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.MapfixID = c
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := func() error {
|
||||||
|
if err := (validate.Int{
|
||||||
|
MinSet: true,
|
||||||
|
Min: 0,
|
||||||
|
MaxSet: false,
|
||||||
|
Max: 0,
|
||||||
|
MinExclusive: false,
|
||||||
|
MaxExclusive: false,
|
||||||
|
MultipleOfSet: false,
|
||||||
|
MultipleOf: 0,
|
||||||
|
}).Validate(int64(params.MapfixID)); err != nil {
|
||||||
|
return errors.Wrap(err, "int")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return validate.ErrFieldRequired
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return params, &ogenerrors.DecodeParamError{
|
||||||
|
Name: "MapfixID",
|
||||||
|
In: "path",
|
||||||
|
Err: err,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ActionMapfixRetryValidateParams is parameters of actionMapfixRetryValidate operation.
|
// ActionMapfixRetryValidateParams is parameters of actionMapfixRetryValidate operation.
|
||||||
type ActionMapfixRetryValidateParams struct {
|
type ActionMapfixRetryValidateParams struct {
|
||||||
// The unique identifier for a mapfix.
|
// The unique identifier for a mapfix.
|
||||||
@@ -430,13 +513,13 @@ func decodeActionMapfixRevokeParams(args [1]string, argsEscaped bool, r *http.Re
|
|||||||
return params, nil
|
return params, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixSubmitParams is parameters of actionMapfixSubmit operation.
|
// ActionMapfixTriggerSubmitParams is parameters of actionMapfixTriggerSubmit operation.
|
||||||
type ActionMapfixSubmitParams struct {
|
type ActionMapfixTriggerSubmitParams struct {
|
||||||
// The unique identifier for a mapfix.
|
// The unique identifier for a mapfix.
|
||||||
MapfixID int64
|
MapfixID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func unpackActionMapfixSubmitParams(packed middleware.Parameters) (params ActionMapfixSubmitParams) {
|
func unpackActionMapfixTriggerSubmitParams(packed middleware.Parameters) (params ActionMapfixTriggerSubmitParams) {
|
||||||
{
|
{
|
||||||
key := middleware.ParameterKey{
|
key := middleware.ParameterKey{
|
||||||
Name: "MapfixID",
|
Name: "MapfixID",
|
||||||
@@ -447,7 +530,7 @@ func unpackActionMapfixSubmitParams(packed middleware.Parameters) (params Action
|
|||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeActionMapfixSubmitParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionMapfixSubmitParams, _ error) {
|
func decodeActionMapfixTriggerSubmitParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionMapfixTriggerSubmitParams, _ error) {
|
||||||
// Decode path: MapfixID.
|
// Decode path: MapfixID.
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
param := args[0]
|
param := args[0]
|
||||||
@@ -1011,6 +1094,89 @@ func decodeActionSubmissionRequestChangesParams(args [1]string, argsEscaped bool
|
|||||||
return params, nil
|
return params, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionSubmissionResetSubmittingParams is parameters of actionSubmissionResetSubmitting operation.
|
||||||
|
type ActionSubmissionResetSubmittingParams struct {
|
||||||
|
// The unique identifier for a submission.
|
||||||
|
SubmissionID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func unpackActionSubmissionResetSubmittingParams(packed middleware.Parameters) (params ActionSubmissionResetSubmittingParams) {
|
||||||
|
{
|
||||||
|
key := middleware.ParameterKey{
|
||||||
|
Name: "SubmissionID",
|
||||||
|
In: "path",
|
||||||
|
}
|
||||||
|
params.SubmissionID = packed[key].(int64)
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|
||||||
|
func decodeActionSubmissionResetSubmittingParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionSubmissionResetSubmittingParams, _ 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
|
||||||
|
}
|
||||||
|
if err := func() error {
|
||||||
|
if err := (validate.Int{
|
||||||
|
MinSet: true,
|
||||||
|
Min: 0,
|
||||||
|
MaxSet: false,
|
||||||
|
Max: 0,
|
||||||
|
MinExclusive: false,
|
||||||
|
MaxExclusive: false,
|
||||||
|
MultipleOfSet: false,
|
||||||
|
MultipleOf: 0,
|
||||||
|
}).Validate(int64(params.SubmissionID)); err != nil {
|
||||||
|
return errors.Wrap(err, "int")
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
// ActionSubmissionRetryValidateParams is parameters of actionSubmissionRetryValidate operation.
|
// ActionSubmissionRetryValidateParams is parameters of actionSubmissionRetryValidate operation.
|
||||||
type ActionSubmissionRetryValidateParams struct {
|
type ActionSubmissionRetryValidateParams struct {
|
||||||
// The unique identifier for a submission.
|
// The unique identifier for a submission.
|
||||||
@@ -1177,13 +1343,13 @@ func decodeActionSubmissionRevokeParams(args [1]string, argsEscaped bool, r *htt
|
|||||||
return params, nil
|
return params, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionSubmitParams is parameters of actionSubmissionSubmit operation.
|
// ActionSubmissionTriggerSubmitParams is parameters of actionSubmissionTriggerSubmit operation.
|
||||||
type ActionSubmissionSubmitParams struct {
|
type ActionSubmissionTriggerSubmitParams struct {
|
||||||
// The unique identifier for a submission.
|
// The unique identifier for a submission.
|
||||||
SubmissionID int64
|
SubmissionID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func unpackActionSubmissionSubmitParams(packed middleware.Parameters) (params ActionSubmissionSubmitParams) {
|
func unpackActionSubmissionTriggerSubmitParams(packed middleware.Parameters) (params ActionSubmissionTriggerSubmitParams) {
|
||||||
{
|
{
|
||||||
key := middleware.ParameterKey{
|
key := middleware.ParameterKey{
|
||||||
Name: "SubmissionID",
|
Name: "SubmissionID",
|
||||||
@@ -1194,7 +1360,7 @@ func unpackActionSubmissionSubmitParams(packed middleware.Parameters) (params Ac
|
|||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeActionSubmissionSubmitParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionSubmissionSubmitParams, _ error) {
|
func decodeActionSubmissionTriggerSubmitParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionSubmissionTriggerSubmitParams, _ error) {
|
||||||
// Decode path: SubmissionID.
|
// Decode path: SubmissionID.
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
param := args[0]
|
param := args[0]
|
||||||
|
|||||||
@@ -195,6 +195,66 @@ func decodeActionMapfixRequestChangesResponse(resp *http.Response) (res *ActionM
|
|||||||
return res, errors.Wrap(defRes, "error")
|
return res, errors.Wrap(defRes, "error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func decodeActionMapfixResetSubmittingResponse(resp *http.Response) (res *ActionMapfixResetSubmittingNoContent, _ error) {
|
||||||
|
switch resp.StatusCode {
|
||||||
|
case 204:
|
||||||
|
// Code 204.
|
||||||
|
return &ActionMapfixResetSubmittingNoContent{}, 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
|
||||||
|
}
|
||||||
|
// Validate response.
|
||||||
|
if err := func() error {
|
||||||
|
if err := response.Validate(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return res, errors.Wrap(err, "validate")
|
||||||
|
}
|
||||||
|
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 decodeActionMapfixRetryValidateResponse(resp *http.Response) (res *ActionMapfixRetryValidateNoContent, _ error) {
|
func decodeActionMapfixRetryValidateResponse(resp *http.Response) (res *ActionMapfixRetryValidateNoContent, _ error) {
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case 204:
|
case 204:
|
||||||
@@ -315,11 +375,11 @@ func decodeActionMapfixRevokeResponse(resp *http.Response) (res *ActionMapfixRev
|
|||||||
return res, errors.Wrap(defRes, "error")
|
return res, errors.Wrap(defRes, "error")
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeActionMapfixSubmitResponse(resp *http.Response) (res *ActionMapfixSubmitNoContent, _ error) {
|
func decodeActionMapfixTriggerSubmitResponse(resp *http.Response) (res *ActionMapfixTriggerSubmitNoContent, _ error) {
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case 204:
|
case 204:
|
||||||
// Code 204.
|
// Code 204.
|
||||||
return &ActionMapfixSubmitNoContent{}, nil
|
return &ActionMapfixTriggerSubmitNoContent{}, nil
|
||||||
}
|
}
|
||||||
// Convenient error response.
|
// Convenient error response.
|
||||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||||
@@ -735,6 +795,66 @@ func decodeActionSubmissionRequestChangesResponse(resp *http.Response) (res *Act
|
|||||||
return res, errors.Wrap(defRes, "error")
|
return res, errors.Wrap(defRes, "error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func decodeActionSubmissionResetSubmittingResponse(resp *http.Response) (res *ActionSubmissionResetSubmittingNoContent, _ error) {
|
||||||
|
switch resp.StatusCode {
|
||||||
|
case 204:
|
||||||
|
// Code 204.
|
||||||
|
return &ActionSubmissionResetSubmittingNoContent{}, 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
|
||||||
|
}
|
||||||
|
// Validate response.
|
||||||
|
if err := func() error {
|
||||||
|
if err := response.Validate(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return res, errors.Wrap(err, "validate")
|
||||||
|
}
|
||||||
|
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 decodeActionSubmissionRetryValidateResponse(resp *http.Response) (res *ActionSubmissionRetryValidateNoContent, _ error) {
|
func decodeActionSubmissionRetryValidateResponse(resp *http.Response) (res *ActionSubmissionRetryValidateNoContent, _ error) {
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case 204:
|
case 204:
|
||||||
@@ -855,11 +975,11 @@ func decodeActionSubmissionRevokeResponse(resp *http.Response) (res *ActionSubmi
|
|||||||
return res, errors.Wrap(defRes, "error")
|
return res, errors.Wrap(defRes, "error")
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeActionSubmissionSubmitResponse(resp *http.Response) (res *ActionSubmissionSubmitNoContent, _ error) {
|
func decodeActionSubmissionTriggerSubmitResponse(resp *http.Response) (res *ActionSubmissionTriggerSubmitNoContent, _ error) {
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case 204:
|
case 204:
|
||||||
// Code 204.
|
// Code 204.
|
||||||
return &ActionSubmissionSubmitNoContent{}, nil
|
return &ActionSubmissionTriggerSubmitNoContent{}, nil
|
||||||
}
|
}
|
||||||
// Convenient error response.
|
// Convenient error response.
|
||||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||||
|
|||||||
@@ -34,6 +34,13 @@ func encodeActionMapfixRequestChangesResponse(response *ActionMapfixRequestChang
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func encodeActionMapfixResetSubmittingResponse(response *ActionMapfixResetSubmittingNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
|
w.WriteHeader(204)
|
||||||
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func encodeActionMapfixRetryValidateResponse(response *ActionMapfixRetryValidateNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionMapfixRetryValidateResponse(response *ActionMapfixRetryValidateNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
@@ -48,7 +55,7 @@ func encodeActionMapfixRevokeResponse(response *ActionMapfixRevokeNoContent, w h
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeActionMapfixSubmitResponse(response *ActionMapfixSubmitNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionMapfixTriggerSubmitResponse(response *ActionMapfixTriggerSubmitNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
|
|
||||||
@@ -97,6 +104,13 @@ func encodeActionSubmissionRequestChangesResponse(response *ActionSubmissionRequ
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func encodeActionSubmissionResetSubmittingResponse(response *ActionSubmissionResetSubmittingNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
|
w.WriteHeader(204)
|
||||||
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func encodeActionSubmissionRetryValidateResponse(response *ActionSubmissionRetryValidateNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionSubmissionRetryValidateResponse(response *ActionSubmissionRetryValidateNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
@@ -111,7 +125,7 @@ func encodeActionSubmissionRevokeResponse(response *ActionSubmissionRevokeNoCont
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeActionSubmissionSubmitResponse(response *ActionSubmissionSubmitNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionSubmissionTriggerSubmitResponse(response *ActionSubmissionTriggerSubmitNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
|
|
||||||
|
|||||||
@@ -318,6 +318,28 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
|
case 's': // Prefix: "submitting"
|
||||||
|
|
||||||
|
if l := len("submitting"); len(elem) >= l && elem[0:l] == "submitting" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch r.Method {
|
||||||
|
case "POST":
|
||||||
|
s.handleActionMapfixResetSubmittingRequest([1]string{
|
||||||
|
args[0],
|
||||||
|
}, elemIsEscaped, w, r)
|
||||||
|
default:
|
||||||
|
s.notAllowed(w, r, "POST")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "uploading"
|
case 'u': // Prefix: "uploading"
|
||||||
|
|
||||||
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
||||||
@@ -410,28 +432,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case 's': // Prefix: "submit"
|
|
||||||
|
|
||||||
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleActionMapfixSubmitRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 't': // Prefix: "trigger-"
|
case 't': // Prefix: "trigger-"
|
||||||
|
|
||||||
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
||||||
@@ -444,6 +444,28 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
|
case 's': // Prefix: "submit"
|
||||||
|
|
||||||
|
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch r.Method {
|
||||||
|
case "POST":
|
||||||
|
s.handleActionMapfixTriggerSubmitRequest([1]string{
|
||||||
|
args[0],
|
||||||
|
}, elemIsEscaped, w, r)
|
||||||
|
default:
|
||||||
|
s.notAllowed(w, r, "POST")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "upload"
|
case 'u': // Prefix: "upload"
|
||||||
|
|
||||||
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
||||||
@@ -1072,6 +1094,28 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
|
case 's': // Prefix: "submitting"
|
||||||
|
|
||||||
|
if l := len("submitting"); len(elem) >= l && elem[0:l] == "submitting" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch r.Method {
|
||||||
|
case "POST":
|
||||||
|
s.handleActionSubmissionResetSubmittingRequest([1]string{
|
||||||
|
args[0],
|
||||||
|
}, elemIsEscaped, w, r)
|
||||||
|
default:
|
||||||
|
s.notAllowed(w, r, "POST")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "uploading"
|
case 'u': // Prefix: "uploading"
|
||||||
|
|
||||||
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
||||||
@@ -1164,28 +1208,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case 's': // Prefix: "submit"
|
|
||||||
|
|
||||||
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleActionSubmissionSubmitRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 't': // Prefix: "trigger-"
|
case 't': // Prefix: "trigger-"
|
||||||
|
|
||||||
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
||||||
@@ -1198,6 +1220,28 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
|
case 's': // Prefix: "submit"
|
||||||
|
|
||||||
|
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch r.Method {
|
||||||
|
case "POST":
|
||||||
|
s.handleActionSubmissionTriggerSubmitRequest([1]string{
|
||||||
|
args[0],
|
||||||
|
}, elemIsEscaped, w, r)
|
||||||
|
default:
|
||||||
|
s.notAllowed(w, r, "POST")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "upload"
|
case 'u': // Prefix: "upload"
|
||||||
|
|
||||||
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
||||||
@@ -1629,6 +1673,30 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
|
case 's': // Prefix: "submitting"
|
||||||
|
|
||||||
|
if l := len("submitting"); len(elem) >= l && elem[0:l] == "submitting" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch method {
|
||||||
|
case "POST":
|
||||||
|
r.name = ActionMapfixResetSubmittingOperation
|
||||||
|
r.summary = "Role Submitter manually resets submitting softlock and changes status from Submitting -> UnderConstruction"
|
||||||
|
r.operationID = "actionMapfixResetSubmitting"
|
||||||
|
r.pathPattern = "/mapfixes/{MapfixID}/status/reset-submitting"
|
||||||
|
r.args = args
|
||||||
|
r.count = 1
|
||||||
|
return r, true
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "uploading"
|
case 'u': // Prefix: "uploading"
|
||||||
|
|
||||||
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
||||||
@@ -1729,30 +1797,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case 's': // Prefix: "submit"
|
|
||||||
|
|
||||||
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = ActionMapfixSubmitOperation
|
|
||||||
r.summary = "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted"
|
|
||||||
r.operationID = "actionMapfixSubmit"
|
|
||||||
r.pathPattern = "/mapfixes/{MapfixID}/status/submit"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 't': // Prefix: "trigger-"
|
case 't': // Prefix: "trigger-"
|
||||||
|
|
||||||
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
||||||
@@ -1765,6 +1809,30 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
|
case 's': // Prefix: "submit"
|
||||||
|
|
||||||
|
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch method {
|
||||||
|
case "POST":
|
||||||
|
r.name = ActionMapfixTriggerSubmitOperation
|
||||||
|
r.summary = "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting"
|
||||||
|
r.operationID = "actionMapfixTriggerSubmit"
|
||||||
|
r.pathPattern = "/mapfixes/{MapfixID}/status/trigger-submit"
|
||||||
|
r.args = args
|
||||||
|
r.count = 1
|
||||||
|
return r, true
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "upload"
|
case 'u': // Prefix: "upload"
|
||||||
|
|
||||||
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
||||||
@@ -2485,6 +2553,30 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
|
case 's': // Prefix: "submitting"
|
||||||
|
|
||||||
|
if l := len("submitting"); len(elem) >= l && elem[0:l] == "submitting" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch method {
|
||||||
|
case "POST":
|
||||||
|
r.name = ActionSubmissionResetSubmittingOperation
|
||||||
|
r.summary = "Role Submitter manually resets submitting softlock and changes status from Submitting -> UnderConstruction"
|
||||||
|
r.operationID = "actionSubmissionResetSubmitting"
|
||||||
|
r.pathPattern = "/submissions/{SubmissionID}/status/reset-submitting"
|
||||||
|
r.args = args
|
||||||
|
r.count = 1
|
||||||
|
return r, true
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "uploading"
|
case 'u': // Prefix: "uploading"
|
||||||
|
|
||||||
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
||||||
@@ -2585,30 +2677,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case 's': // Prefix: "submit"
|
|
||||||
|
|
||||||
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = ActionSubmissionSubmitOperation
|
|
||||||
r.summary = "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted"
|
|
||||||
r.operationID = "actionSubmissionSubmit"
|
|
||||||
r.pathPattern = "/submissions/{SubmissionID}/status/submit"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 't': // Prefix: "trigger-"
|
case 't': // Prefix: "trigger-"
|
||||||
|
|
||||||
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
||||||
@@ -2621,6 +2689,30 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
|
case 's': // Prefix: "submit"
|
||||||
|
|
||||||
|
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch method {
|
||||||
|
case "POST":
|
||||||
|
r.name = ActionSubmissionTriggerSubmitOperation
|
||||||
|
r.summary = "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting"
|
||||||
|
r.operationID = "actionSubmissionTriggerSubmit"
|
||||||
|
r.pathPattern = "/submissions/{SubmissionID}/status/trigger-submit"
|
||||||
|
r.args = args
|
||||||
|
r.count = 1
|
||||||
|
return r, true
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "upload"
|
case 'u': // Prefix: "upload"
|
||||||
|
|
||||||
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
||||||
|
|||||||
@@ -23,14 +23,17 @@ type ActionMapfixRejectNoContent struct{}
|
|||||||
// ActionMapfixRequestChangesNoContent is response for ActionMapfixRequestChanges operation.
|
// ActionMapfixRequestChangesNoContent is response for ActionMapfixRequestChanges operation.
|
||||||
type ActionMapfixRequestChangesNoContent struct{}
|
type ActionMapfixRequestChangesNoContent struct{}
|
||||||
|
|
||||||
|
// ActionMapfixResetSubmittingNoContent is response for ActionMapfixResetSubmitting operation.
|
||||||
|
type ActionMapfixResetSubmittingNoContent struct{}
|
||||||
|
|
||||||
// ActionMapfixRetryValidateNoContent is response for ActionMapfixRetryValidate operation.
|
// ActionMapfixRetryValidateNoContent is response for ActionMapfixRetryValidate operation.
|
||||||
type ActionMapfixRetryValidateNoContent struct{}
|
type ActionMapfixRetryValidateNoContent struct{}
|
||||||
|
|
||||||
// ActionMapfixRevokeNoContent is response for ActionMapfixRevoke operation.
|
// ActionMapfixRevokeNoContent is response for ActionMapfixRevoke operation.
|
||||||
type ActionMapfixRevokeNoContent struct{}
|
type ActionMapfixRevokeNoContent struct{}
|
||||||
|
|
||||||
// ActionMapfixSubmitNoContent is response for ActionMapfixSubmit operation.
|
// ActionMapfixTriggerSubmitNoContent is response for ActionMapfixTriggerSubmit operation.
|
||||||
type ActionMapfixSubmitNoContent struct{}
|
type ActionMapfixTriggerSubmitNoContent struct{}
|
||||||
|
|
||||||
// ActionMapfixTriggerUploadNoContent is response for ActionMapfixTriggerUpload operation.
|
// ActionMapfixTriggerUploadNoContent is response for ActionMapfixTriggerUpload operation.
|
||||||
type ActionMapfixTriggerUploadNoContent struct{}
|
type ActionMapfixTriggerUploadNoContent struct{}
|
||||||
@@ -50,14 +53,17 @@ type ActionSubmissionRejectNoContent struct{}
|
|||||||
// ActionSubmissionRequestChangesNoContent is response for ActionSubmissionRequestChanges operation.
|
// ActionSubmissionRequestChangesNoContent is response for ActionSubmissionRequestChanges operation.
|
||||||
type ActionSubmissionRequestChangesNoContent struct{}
|
type ActionSubmissionRequestChangesNoContent struct{}
|
||||||
|
|
||||||
|
// ActionSubmissionResetSubmittingNoContent is response for ActionSubmissionResetSubmitting operation.
|
||||||
|
type ActionSubmissionResetSubmittingNoContent struct{}
|
||||||
|
|
||||||
// ActionSubmissionRetryValidateNoContent is response for ActionSubmissionRetryValidate operation.
|
// ActionSubmissionRetryValidateNoContent is response for ActionSubmissionRetryValidate operation.
|
||||||
type ActionSubmissionRetryValidateNoContent struct{}
|
type ActionSubmissionRetryValidateNoContent struct{}
|
||||||
|
|
||||||
// ActionSubmissionRevokeNoContent is response for ActionSubmissionRevoke operation.
|
// ActionSubmissionRevokeNoContent is response for ActionSubmissionRevoke operation.
|
||||||
type ActionSubmissionRevokeNoContent struct{}
|
type ActionSubmissionRevokeNoContent struct{}
|
||||||
|
|
||||||
// ActionSubmissionSubmitNoContent is response for ActionSubmissionSubmit operation.
|
// ActionSubmissionTriggerSubmitNoContent is response for ActionSubmissionTriggerSubmit operation.
|
||||||
type ActionSubmissionSubmitNoContent struct{}
|
type ActionSubmissionTriggerSubmitNoContent struct{}
|
||||||
|
|
||||||
// ActionSubmissionTriggerUploadNoContent is response for ActionSubmissionTriggerUpload operation.
|
// ActionSubmissionTriggerUploadNoContent is response for ActionSubmissionTriggerUpload operation.
|
||||||
type ActionSubmissionTriggerUploadNoContent struct{}
|
type ActionSubmissionTriggerUploadNoContent struct{}
|
||||||
|
|||||||
@@ -26,6 +26,13 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/request-changes
|
// POST /mapfixes/{MapfixID}/status/request-changes
|
||||||
ActionMapfixRequestChanges(ctx context.Context, params ActionMapfixRequestChangesParams) error
|
ActionMapfixRequestChanges(ctx context.Context, params ActionMapfixRequestChangesParams) error
|
||||||
|
// ActionMapfixResetSubmitting implements actionMapfixResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/reset-submitting
|
||||||
|
ActionMapfixResetSubmitting(ctx context.Context, params ActionMapfixResetSubmittingParams) error
|
||||||
// ActionMapfixRetryValidate implements actionMapfixRetryValidate operation.
|
// ActionMapfixRetryValidate implements actionMapfixRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -38,12 +45,12 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/revoke
|
// POST /mapfixes/{MapfixID}/status/revoke
|
||||||
ActionMapfixRevoke(ctx context.Context, params ActionMapfixRevokeParams) error
|
ActionMapfixRevoke(ctx context.Context, params ActionMapfixRevokeParams) error
|
||||||
// ActionMapfixSubmit implements actionMapfixSubmit operation.
|
// ActionMapfixTriggerSubmit implements actionMapfixTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/submit
|
// POST /mapfixes/{MapfixID}/status/trigger-submit
|
||||||
ActionMapfixSubmit(ctx context.Context, params ActionMapfixSubmitParams) error
|
ActionMapfixTriggerSubmit(ctx context.Context, params ActionMapfixTriggerSubmitParams) error
|
||||||
// ActionMapfixTriggerUpload implements actionMapfixTriggerUpload operation.
|
// ActionMapfixTriggerUpload implements actionMapfixTriggerUpload operation.
|
||||||
//
|
//
|
||||||
// Role Admin changes status from Validated -> Uploading.
|
// Role Admin changes status from Validated -> Uploading.
|
||||||
@@ -80,6 +87,13 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/request-changes
|
// POST /submissions/{SubmissionID}/status/request-changes
|
||||||
ActionSubmissionRequestChanges(ctx context.Context, params ActionSubmissionRequestChangesParams) error
|
ActionSubmissionRequestChanges(ctx context.Context, params ActionSubmissionRequestChangesParams) error
|
||||||
|
// ActionSubmissionResetSubmitting implements actionSubmissionResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/reset-submitting
|
||||||
|
ActionSubmissionResetSubmitting(ctx context.Context, params ActionSubmissionResetSubmittingParams) error
|
||||||
// ActionSubmissionRetryValidate implements actionSubmissionRetryValidate operation.
|
// ActionSubmissionRetryValidate implements actionSubmissionRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -92,12 +106,12 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/revoke
|
// POST /submissions/{SubmissionID}/status/revoke
|
||||||
ActionSubmissionRevoke(ctx context.Context, params ActionSubmissionRevokeParams) error
|
ActionSubmissionRevoke(ctx context.Context, params ActionSubmissionRevokeParams) error
|
||||||
// ActionSubmissionSubmit implements actionSubmissionSubmit operation.
|
// ActionSubmissionTriggerSubmit implements actionSubmissionTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/submit
|
// POST /submissions/{SubmissionID}/status/trigger-submit
|
||||||
ActionSubmissionSubmit(ctx context.Context, params ActionSubmissionSubmitParams) error
|
ActionSubmissionTriggerSubmit(ctx context.Context, params ActionSubmissionTriggerSubmitParams) error
|
||||||
// ActionSubmissionTriggerUpload implements actionSubmissionTriggerUpload operation.
|
// ActionSubmissionTriggerUpload implements actionSubmissionTriggerUpload operation.
|
||||||
//
|
//
|
||||||
// Role Admin changes status from Validated -> Uploading.
|
// Role Admin changes status from Validated -> Uploading.
|
||||||
|
|||||||
@@ -40,6 +40,16 @@ func (UnimplementedHandler) ActionMapfixRequestChanges(ctx context.Context, para
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionMapfixResetSubmitting implements actionMapfixResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/reset-submitting
|
||||||
|
func (UnimplementedHandler) ActionMapfixResetSubmitting(ctx context.Context, params ActionMapfixResetSubmittingParams) error {
|
||||||
|
return ht.ErrNotImplemented
|
||||||
|
}
|
||||||
|
|
||||||
// ActionMapfixRetryValidate implements actionMapfixRetryValidate operation.
|
// ActionMapfixRetryValidate implements actionMapfixRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -58,12 +68,12 @@ func (UnimplementedHandler) ActionMapfixRevoke(ctx context.Context, params Actio
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixSubmit implements actionMapfixSubmit operation.
|
// ActionMapfixTriggerSubmit implements actionMapfixTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/submit
|
// POST /mapfixes/{MapfixID}/status/trigger-submit
|
||||||
func (UnimplementedHandler) ActionMapfixSubmit(ctx context.Context, params ActionMapfixSubmitParams) error {
|
func (UnimplementedHandler) ActionMapfixTriggerSubmit(ctx context.Context, params ActionMapfixTriggerSubmitParams) error {
|
||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +131,16 @@ func (UnimplementedHandler) ActionSubmissionRequestChanges(ctx context.Context,
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionSubmissionResetSubmitting implements actionSubmissionResetSubmitting operation.
|
||||||
|
//
|
||||||
|
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
||||||
|
// UnderConstruction.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/reset-submitting
|
||||||
|
func (UnimplementedHandler) ActionSubmissionResetSubmitting(ctx context.Context, params ActionSubmissionResetSubmittingParams) error {
|
||||||
|
return ht.ErrNotImplemented
|
||||||
|
}
|
||||||
|
|
||||||
// ActionSubmissionRetryValidate implements actionSubmissionRetryValidate operation.
|
// ActionSubmissionRetryValidate implements actionSubmissionRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -139,12 +159,12 @@ func (UnimplementedHandler) ActionSubmissionRevoke(ctx context.Context, params A
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionSubmit implements actionSubmissionSubmit operation.
|
// ActionSubmissionTriggerSubmit implements actionSubmissionTriggerSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/submit
|
// POST /submissions/{SubmissionID}/status/trigger-submit
|
||||||
func (UnimplementedHandler) ActionSubmissionSubmit(ctx context.Context, params ActionSubmissionSubmitParams) error {
|
func (UnimplementedHandler) ActionSubmissionTriggerSubmit(ctx context.Context, params ActionSubmissionTriggerSubmitParams) error {
|
||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ type Invoker interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-failed
|
// POST /mapfixes/{MapfixID}/status/validator-failed
|
||||||
ActionMapfixAccepted(ctx context.Context, params ActionMapfixAcceptedParams) error
|
ActionMapfixAccepted(ctx context.Context, params ActionMapfixAcceptedParams) error
|
||||||
|
// ActionMapfixSubmitted invokes actionMapfixSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
||||||
|
ActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) error
|
||||||
// ActionMapfixUploaded invokes actionMapfixUploaded operation.
|
// ActionMapfixUploaded invokes actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -58,6 +64,12 @@ type Invoker interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/validator-failed
|
// POST /submissions/{SubmissionID}/status/validator-failed
|
||||||
ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error
|
ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error
|
||||||
|
// ActionSubmissionSubmitted invokes actionSubmissionSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/validator-submitted
|
||||||
|
ActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) error
|
||||||
// ActionSubmissionUploaded invokes actionSubmissionUploaded operation.
|
// ActionSubmissionUploaded invokes actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -282,6 +294,97 @@ func (c *Client) sendActionMapfixAccepted(ctx context.Context, params ActionMapf
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionMapfixSubmitted invokes actionMapfixSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
||||||
|
func (c *Client) ActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) error {
|
||||||
|
_, err := c.sendActionMapfixSubmitted(ctx, params)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) sendActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) (res *ActionMapfixSubmittedNoContent, err error) {
|
||||||
|
otelAttrs := []attribute.KeyValue{
|
||||||
|
otelogen.OperationID("actionMapfixSubmitted"),
|
||||||
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
|
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/validator-submitted"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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, ActionMapfixSubmittedOperation,
|
||||||
|
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] = "/mapfixes/"
|
||||||
|
{
|
||||||
|
// Encode "MapfixID" parameter.
|
||||||
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
||||||
|
Param: "MapfixID",
|
||||||
|
Style: uri.PathStyleSimple,
|
||||||
|
Explode: false,
|
||||||
|
})
|
||||||
|
if err := func() error {
|
||||||
|
return e.EncodeValue(conv.Int64ToString(params.MapfixID))
|
||||||
|
}(); 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/validator-submitted"
|
||||||
|
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 := decodeActionMapfixSubmittedResponse(resp)
|
||||||
|
if err != nil {
|
||||||
|
return res, errors.Wrap(err, "decode response")
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ActionMapfixUploaded invokes actionMapfixUploaded operation.
|
// ActionMapfixUploaded invokes actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -682,6 +785,97 @@ func (c *Client) sendActionSubmissionAccepted(ctx context.Context, params Action
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionSubmissionSubmitted invokes actionSubmissionSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/validator-submitted
|
||||||
|
func (c *Client) ActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) error {
|
||||||
|
_, err := c.sendActionSubmissionSubmitted(ctx, params)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) sendActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) (res *ActionSubmissionSubmittedNoContent, err error) {
|
||||||
|
otelAttrs := []attribute.KeyValue{
|
||||||
|
otelogen.OperationID("actionSubmissionSubmitted"),
|
||||||
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
|
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validator-submitted"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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, ActionSubmissionSubmittedOperation,
|
||||||
|
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/validator-submitted"
|
||||||
|
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 := decodeActionSubmissionSubmittedResponse(resp)
|
||||||
|
if err != nil {
|
||||||
|
return res, errors.Wrap(err, "decode response")
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ActionSubmissionUploaded invokes actionSubmissionUploaded operation.
|
// ActionSubmissionUploaded invokes actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
|
|||||||
@@ -183,6 +183,155 @@ func (s *Server) handleActionMapfixAcceptedRequest(args [1]string, argsEscaped b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handleActionMapfixSubmittedRequest handles actionMapfixSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
||||||
|
func (s *Server) handleActionMapfixSubmittedRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||||
|
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||||
|
w = statusWriter
|
||||||
|
otelAttrs := []attribute.KeyValue{
|
||||||
|
otelogen.OperationID("actionMapfixSubmitted"),
|
||||||
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
|
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/validator-submitted"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start a span for this request.
|
||||||
|
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionMapfixSubmittedOperation,
|
||||||
|
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: ActionMapfixSubmittedOperation,
|
||||||
|
ID: "actionMapfixSubmitted",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
params, err := decodeActionMapfixSubmittedParams(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 *ActionMapfixSubmittedNoContent
|
||||||
|
if m := s.cfg.Middleware; m != nil {
|
||||||
|
mreq := middleware.Request{
|
||||||
|
Context: ctx,
|
||||||
|
OperationName: ActionMapfixSubmittedOperation,
|
||||||
|
OperationSummary: "(Internal endpoint) Role Validator changes status from Submitting -> Submitted",
|
||||||
|
OperationID: "actionMapfixSubmitted",
|
||||||
|
Body: nil,
|
||||||
|
Params: middleware.Parameters{
|
||||||
|
{
|
||||||
|
Name: "MapfixID",
|
||||||
|
In: "path",
|
||||||
|
}: params.MapfixID,
|
||||||
|
},
|
||||||
|
Raw: r,
|
||||||
|
}
|
||||||
|
|
||||||
|
type (
|
||||||
|
Request = struct{}
|
||||||
|
Params = ActionMapfixSubmittedParams
|
||||||
|
Response = *ActionMapfixSubmittedNoContent
|
||||||
|
)
|
||||||
|
response, err = middleware.HookMiddleware[
|
||||||
|
Request,
|
||||||
|
Params,
|
||||||
|
Response,
|
||||||
|
](
|
||||||
|
m,
|
||||||
|
mreq,
|
||||||
|
unpackActionMapfixSubmittedParams,
|
||||||
|
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||||
|
err = s.h.ActionMapfixSubmitted(ctx, params)
|
||||||
|
return response, err
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
err = s.h.ActionMapfixSubmitted(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 := encodeActionMapfixSubmittedResponse(response, w, span); err != nil {
|
||||||
|
defer recordError("EncodeResponse", err)
|
||||||
|
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||||
|
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// handleActionMapfixUploadedRequest handles actionMapfixUploaded operation.
|
// handleActionMapfixUploadedRequest handles actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -787,6 +936,155 @@ func (s *Server) handleActionSubmissionAcceptedRequest(args [1]string, argsEscap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handleActionSubmissionSubmittedRequest handles actionSubmissionSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/validator-submitted
|
||||||
|
func (s *Server) handleActionSubmissionSubmittedRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||||
|
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||||
|
w = statusWriter
|
||||||
|
otelAttrs := []attribute.KeyValue{
|
||||||
|
otelogen.OperationID("actionSubmissionSubmitted"),
|
||||||
|
semconv.HTTPRequestMethodKey.String("POST"),
|
||||||
|
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validator-submitted"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start a span for this request.
|
||||||
|
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionSubmissionSubmittedOperation,
|
||||||
|
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: ActionSubmissionSubmittedOperation,
|
||||||
|
ID: "actionSubmissionSubmitted",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
params, err := decodeActionSubmissionSubmittedParams(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 *ActionSubmissionSubmittedNoContent
|
||||||
|
if m := s.cfg.Middleware; m != nil {
|
||||||
|
mreq := middleware.Request{
|
||||||
|
Context: ctx,
|
||||||
|
OperationName: ActionSubmissionSubmittedOperation,
|
||||||
|
OperationSummary: "(Internal endpoint) Role Validator changes status from Submitting -> Submitted",
|
||||||
|
OperationID: "actionSubmissionSubmitted",
|
||||||
|
Body: nil,
|
||||||
|
Params: middleware.Parameters{
|
||||||
|
{
|
||||||
|
Name: "SubmissionID",
|
||||||
|
In: "path",
|
||||||
|
}: params.SubmissionID,
|
||||||
|
},
|
||||||
|
Raw: r,
|
||||||
|
}
|
||||||
|
|
||||||
|
type (
|
||||||
|
Request = struct{}
|
||||||
|
Params = ActionSubmissionSubmittedParams
|
||||||
|
Response = *ActionSubmissionSubmittedNoContent
|
||||||
|
)
|
||||||
|
response, err = middleware.HookMiddleware[
|
||||||
|
Request,
|
||||||
|
Params,
|
||||||
|
Response,
|
||||||
|
](
|
||||||
|
m,
|
||||||
|
mreq,
|
||||||
|
unpackActionSubmissionSubmittedParams,
|
||||||
|
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||||
|
err = s.h.ActionSubmissionSubmitted(ctx, params)
|
||||||
|
return response, err
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
err = s.h.ActionSubmissionSubmitted(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 := encodeActionSubmissionSubmittedResponse(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.
|
// handleActionSubmissionUploadedRequest handles actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ type OperationName = string
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
ActionMapfixAcceptedOperation OperationName = "ActionMapfixAccepted"
|
ActionMapfixAcceptedOperation OperationName = "ActionMapfixAccepted"
|
||||||
|
ActionMapfixSubmittedOperation OperationName = "ActionMapfixSubmitted"
|
||||||
ActionMapfixUploadedOperation OperationName = "ActionMapfixUploaded"
|
ActionMapfixUploadedOperation OperationName = "ActionMapfixUploaded"
|
||||||
ActionMapfixValidatedOperation OperationName = "ActionMapfixValidated"
|
ActionMapfixValidatedOperation OperationName = "ActionMapfixValidated"
|
||||||
ActionOperationFailedOperation OperationName = "ActionOperationFailed"
|
ActionOperationFailedOperation OperationName = "ActionOperationFailed"
|
||||||
ActionSubmissionAcceptedOperation OperationName = "ActionSubmissionAccepted"
|
ActionSubmissionAcceptedOperation OperationName = "ActionSubmissionAccepted"
|
||||||
|
ActionSubmissionSubmittedOperation OperationName = "ActionSubmissionSubmitted"
|
||||||
ActionSubmissionUploadedOperation OperationName = "ActionSubmissionUploaded"
|
ActionSubmissionUploadedOperation OperationName = "ActionSubmissionUploaded"
|
||||||
ActionSubmissionValidatedOperation OperationName = "ActionSubmissionValidated"
|
ActionSubmissionValidatedOperation OperationName = "ActionSubmissionValidated"
|
||||||
CreateMapfixOperation OperationName = "CreateMapfix"
|
CreateMapfixOperation OperationName = "CreateMapfix"
|
||||||
|
|||||||
@@ -159,6 +159,89 @@ func decodeActionMapfixAcceptedParams(args [1]string, argsEscaped bool, r *http.
|
|||||||
return params, nil
|
return params, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionMapfixSubmittedParams is parameters of actionMapfixSubmitted operation.
|
||||||
|
type ActionMapfixSubmittedParams struct {
|
||||||
|
// The unique identifier for a submission.
|
||||||
|
MapfixID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func unpackActionMapfixSubmittedParams(packed middleware.Parameters) (params ActionMapfixSubmittedParams) {
|
||||||
|
{
|
||||||
|
key := middleware.ParameterKey{
|
||||||
|
Name: "MapfixID",
|
||||||
|
In: "path",
|
||||||
|
}
|
||||||
|
params.MapfixID = packed[key].(int64)
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|
||||||
|
func decodeActionMapfixSubmittedParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionMapfixSubmittedParams, _ error) {
|
||||||
|
// Decode path: MapfixID.
|
||||||
|
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: "MapfixID",
|
||||||
|
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.MapfixID = c
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := func() error {
|
||||||
|
if err := (validate.Int{
|
||||||
|
MinSet: true,
|
||||||
|
Min: 0,
|
||||||
|
MaxSet: false,
|
||||||
|
Max: 0,
|
||||||
|
MinExclusive: false,
|
||||||
|
MaxExclusive: false,
|
||||||
|
MultipleOfSet: false,
|
||||||
|
MultipleOf: 0,
|
||||||
|
}).Validate(int64(params.MapfixID)); err != nil {
|
||||||
|
return errors.Wrap(err, "int")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return validate.ErrFieldRequired
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return params, &ogenerrors.DecodeParamError{
|
||||||
|
Name: "MapfixID",
|
||||||
|
In: "path",
|
||||||
|
Err: err,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ActionMapfixUploadedParams is parameters of actionMapfixUploaded operation.
|
// ActionMapfixUploadedParams is parameters of actionMapfixUploaded operation.
|
||||||
type ActionMapfixUploadedParams struct {
|
type ActionMapfixUploadedParams struct {
|
||||||
// The unique identifier for a submission.
|
// The unique identifier for a submission.
|
||||||
@@ -613,6 +696,89 @@ func decodeActionSubmissionAcceptedParams(args [1]string, argsEscaped bool, r *h
|
|||||||
return params, nil
|
return params, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionSubmissionSubmittedParams is parameters of actionSubmissionSubmitted operation.
|
||||||
|
type ActionSubmissionSubmittedParams struct {
|
||||||
|
// The unique identifier for a submission.
|
||||||
|
SubmissionID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func unpackActionSubmissionSubmittedParams(packed middleware.Parameters) (params ActionSubmissionSubmittedParams) {
|
||||||
|
{
|
||||||
|
key := middleware.ParameterKey{
|
||||||
|
Name: "SubmissionID",
|
||||||
|
In: "path",
|
||||||
|
}
|
||||||
|
params.SubmissionID = packed[key].(int64)
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|
||||||
|
func decodeActionSubmissionSubmittedParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionSubmissionSubmittedParams, _ 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
|
||||||
|
}
|
||||||
|
if err := func() error {
|
||||||
|
if err := (validate.Int{
|
||||||
|
MinSet: true,
|
||||||
|
Min: 0,
|
||||||
|
MaxSet: false,
|
||||||
|
Max: 0,
|
||||||
|
MinExclusive: false,
|
||||||
|
MaxExclusive: false,
|
||||||
|
MultipleOfSet: false,
|
||||||
|
MultipleOf: 0,
|
||||||
|
}).Validate(int64(params.SubmissionID)); err != nil {
|
||||||
|
return errors.Wrap(err, "int")
|
||||||
|
}
|
||||||
|
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.
|
// ActionSubmissionUploadedParams is parameters of actionSubmissionUploaded operation.
|
||||||
type ActionSubmissionUploadedParams struct {
|
type ActionSubmissionUploadedParams struct {
|
||||||
// The unique identifier for a submission.
|
// The unique identifier for a submission.
|
||||||
|
|||||||
@@ -75,6 +75,66 @@ func decodeActionMapfixAcceptedResponse(resp *http.Response) (res *ActionMapfixA
|
|||||||
return res, errors.Wrap(defRes, "error")
|
return res, errors.Wrap(defRes, "error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func decodeActionMapfixSubmittedResponse(resp *http.Response) (res *ActionMapfixSubmittedNoContent, _ error) {
|
||||||
|
switch resp.StatusCode {
|
||||||
|
case 204:
|
||||||
|
// Code 204.
|
||||||
|
return &ActionMapfixSubmittedNoContent{}, 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
|
||||||
|
}
|
||||||
|
// Validate response.
|
||||||
|
if err := func() error {
|
||||||
|
if err := response.Validate(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return res, errors.Wrap(err, "validate")
|
||||||
|
}
|
||||||
|
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 decodeActionMapfixUploadedResponse(resp *http.Response) (res *ActionMapfixUploadedNoContent, _ error) {
|
func decodeActionMapfixUploadedResponse(resp *http.Response) (res *ActionMapfixUploadedNoContent, _ error) {
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case 204:
|
case 204:
|
||||||
@@ -315,6 +375,66 @@ func decodeActionSubmissionAcceptedResponse(resp *http.Response) (res *ActionSub
|
|||||||
return res, errors.Wrap(defRes, "error")
|
return res, errors.Wrap(defRes, "error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func decodeActionSubmissionSubmittedResponse(resp *http.Response) (res *ActionSubmissionSubmittedNoContent, _ error) {
|
||||||
|
switch resp.StatusCode {
|
||||||
|
case 204:
|
||||||
|
// Code 204.
|
||||||
|
return &ActionSubmissionSubmittedNoContent{}, 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
|
||||||
|
}
|
||||||
|
// Validate response.
|
||||||
|
if err := func() error {
|
||||||
|
if err := response.Validate(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}(); err != nil {
|
||||||
|
return res, errors.Wrap(err, "validate")
|
||||||
|
}
|
||||||
|
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) {
|
func decodeActionSubmissionUploadedResponse(resp *http.Response) (res *ActionSubmissionUploadedNoContent, _ error) {
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case 204:
|
case 204:
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ func encodeActionMapfixAcceptedResponse(response *ActionMapfixAcceptedNoContent,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func encodeActionMapfixSubmittedResponse(response *ActionMapfixSubmittedNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
|
w.WriteHeader(204)
|
||||||
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func encodeActionMapfixUploadedResponse(response *ActionMapfixUploadedNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionMapfixUploadedResponse(response *ActionMapfixUploadedNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
@@ -48,6 +55,13 @@ func encodeActionSubmissionAcceptedResponse(response *ActionSubmissionAcceptedNo
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func encodeActionSubmissionSubmittedResponse(response *ActionSubmissionSubmittedNoContent, 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 {
|
func encodeActionSubmissionUploadedResponse(response *ActionSubmissionUploadedNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
|
|||||||
@@ -147,6 +147,28 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 's': // Prefix: "submitted"
|
||||||
|
|
||||||
|
if l := len("submitted"); len(elem) >= l && elem[0:l] == "submitted" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch r.Method {
|
||||||
|
case "POST":
|
||||||
|
s.handleActionMapfixSubmittedRequest([1]string{
|
||||||
|
args[0],
|
||||||
|
}, elemIsEscaped, w, r)
|
||||||
|
default:
|
||||||
|
s.notAllowed(w, r, "POST")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "uploaded"
|
case 'u': // Prefix: "uploaded"
|
||||||
|
|
||||||
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
||||||
@@ -454,6 +476,28 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 's': // Prefix: "submitted"
|
||||||
|
|
||||||
|
if l := len("submitted"); len(elem) >= l && elem[0:l] == "submitted" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch r.Method {
|
||||||
|
case "POST":
|
||||||
|
s.handleActionSubmissionSubmittedRequest([1]string{
|
||||||
|
args[0],
|
||||||
|
}, elemIsEscaped, w, r)
|
||||||
|
default:
|
||||||
|
s.notAllowed(w, r, "POST")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "uploaded"
|
case 'u': // Prefix: "uploaded"
|
||||||
|
|
||||||
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
||||||
@@ -716,6 +760,30 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 's': // Prefix: "submitted"
|
||||||
|
|
||||||
|
if l := len("submitted"); len(elem) >= l && elem[0:l] == "submitted" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch method {
|
||||||
|
case "POST":
|
||||||
|
r.name = ActionMapfixSubmittedOperation
|
||||||
|
r.summary = "(Internal endpoint) Role Validator changes status from Submitting -> Submitted"
|
||||||
|
r.operationID = "actionMapfixSubmitted"
|
||||||
|
r.pathPattern = "/mapfixes/{MapfixID}/status/validator-submitted"
|
||||||
|
r.args = args
|
||||||
|
r.count = 1
|
||||||
|
return r, true
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "uploaded"
|
case 'u': // Prefix: "uploaded"
|
||||||
|
|
||||||
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
||||||
@@ -1059,6 +1127,30 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 's': // Prefix: "submitted"
|
||||||
|
|
||||||
|
if l := len("submitted"); len(elem) >= l && elem[0:l] == "submitted" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch method {
|
||||||
|
case "POST":
|
||||||
|
r.name = ActionSubmissionSubmittedOperation
|
||||||
|
r.summary = "(Internal endpoint) Role Validator changes status from Submitting -> Submitted"
|
||||||
|
r.operationID = "actionSubmissionSubmitted"
|
||||||
|
r.pathPattern = "/submissions/{SubmissionID}/status/validator-submitted"
|
||||||
|
r.args = args
|
||||||
|
r.count = 1
|
||||||
|
return r, true
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case 'u': // Prefix: "uploaded"
|
case 'u': // Prefix: "uploaded"
|
||||||
|
|
||||||
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ func (s *ErrorStatusCode) Error() string {
|
|||||||
// ActionMapfixAcceptedNoContent is response for ActionMapfixAccepted operation.
|
// ActionMapfixAcceptedNoContent is response for ActionMapfixAccepted operation.
|
||||||
type ActionMapfixAcceptedNoContent struct{}
|
type ActionMapfixAcceptedNoContent struct{}
|
||||||
|
|
||||||
|
// ActionMapfixSubmittedNoContent is response for ActionMapfixSubmitted operation.
|
||||||
|
type ActionMapfixSubmittedNoContent struct{}
|
||||||
|
|
||||||
// ActionMapfixUploadedNoContent is response for ActionMapfixUploaded operation.
|
// ActionMapfixUploadedNoContent is response for ActionMapfixUploaded operation.
|
||||||
type ActionMapfixUploadedNoContent struct{}
|
type ActionMapfixUploadedNoContent struct{}
|
||||||
|
|
||||||
@@ -25,6 +28,9 @@ type ActionOperationFailedNoContent struct{}
|
|||||||
// ActionSubmissionAcceptedNoContent is response for ActionSubmissionAccepted operation.
|
// ActionSubmissionAcceptedNoContent is response for ActionSubmissionAccepted operation.
|
||||||
type ActionSubmissionAcceptedNoContent struct{}
|
type ActionSubmissionAcceptedNoContent struct{}
|
||||||
|
|
||||||
|
// ActionSubmissionSubmittedNoContent is response for ActionSubmissionSubmitted operation.
|
||||||
|
type ActionSubmissionSubmittedNoContent struct{}
|
||||||
|
|
||||||
// ActionSubmissionUploadedNoContent is response for ActionSubmissionUploaded operation.
|
// ActionSubmissionUploadedNoContent is response for ActionSubmissionUploaded operation.
|
||||||
type ActionSubmissionUploadedNoContent struct{}
|
type ActionSubmissionUploadedNoContent struct{}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-failed
|
// POST /mapfixes/{MapfixID}/status/validator-failed
|
||||||
ActionMapfixAccepted(ctx context.Context, params ActionMapfixAcceptedParams) error
|
ActionMapfixAccepted(ctx context.Context, params ActionMapfixAcceptedParams) error
|
||||||
|
// ActionMapfixSubmitted implements actionMapfixSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
||||||
|
ActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) error
|
||||||
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -38,6 +44,12 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/validator-failed
|
// POST /submissions/{SubmissionID}/status/validator-failed
|
||||||
ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error
|
ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error
|
||||||
|
// ActionSubmissionSubmitted implements actionSubmissionSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/validator-submitted
|
||||||
|
ActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) error
|
||||||
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
|
|||||||
@@ -22,6 +22,15 @@ func (UnimplementedHandler) ActionMapfixAccepted(ctx context.Context, params Act
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionMapfixSubmitted implements actionMapfixSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
||||||
|
func (UnimplementedHandler) ActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) error {
|
||||||
|
return ht.ErrNotImplemented
|
||||||
|
}
|
||||||
|
|
||||||
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -58,6 +67,15 @@ func (UnimplementedHandler) ActionSubmissionAccepted(ctx context.Context, params
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionSubmissionSubmitted implements actionSubmissionSubmitted operation.
|
||||||
|
//
|
||||||
|
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
||||||
|
//
|
||||||
|
// POST /submissions/{SubmissionID}/status/validator-submitted
|
||||||
|
func (UnimplementedHandler) ActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) error {
|
||||||
|
return ht.ErrNotImplemented
|
||||||
|
}
|
||||||
|
|
||||||
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
|
|||||||
Reference in New Issue
Block a user