feat(labs): describe the lab task contract and the provisioner port
This commit is contained in:
1 parent
3de226b16c
commit
9fdaa62b9b
91 files changed
+19262
-155
No files matched your search
@@ -17,27 +17,29 @@ import (
|
||||
)
|
||||
|
||||
var regexMap = map[string]ogenregex.Regexp{
|
||||
"\\S": ogenregex.MustCompile("\\S"),
|
||||
"^(/([^~/]|~[01])*)*$": ogenregex.MustCompile("^(/([^~/]|~[01])*)*$"),
|
||||
"^/[A-Za-z0-9/_-]{0,255}$": ogenregex.MustCompile("^/[A-Za-z0-9/_-]{0,255}$"),
|
||||
"^@[A-Za-z0-9_]{5,32}$": ogenregex.MustCompile("^@[A-Za-z0-9_]{5,32}$"),
|
||||
"^SC-[0-9]{4}-[0-9]{6,10}$": ogenregex.MustCompile("^SC-[0-9]{4}-[0-9]{6,10}$"),
|
||||
"^[0-9A-HJKMNP-TV-Z]{5}-?[0-9A-HJKMNP-TV-Z]{5}$": ogenregex.MustCompile("^[0-9A-HJKMNP-TV-Z]{5}-?[0-9A-HJKMNP-TV-Z]{5}$"),
|
||||
"^[0-9]{4}-(0[1-9]|1[0-2])$": ogenregex.MustCompile("^[0-9]{4}-(0[1-9]|1[0-2])$"),
|
||||
"^[0-9]{6}$": ogenregex.MustCompile("^[0-9]{6}$"),
|
||||
"^[A-Za-z0-9._-]+$": ogenregex.MustCompile("^[A-Za-z0-9._-]+$"),
|
||||
"^[A-Za-z0-9._:-]+$": ogenregex.MustCompile("^[A-Za-z0-9._:-]+$"),
|
||||
"^[A-Za-z0-9_-]+$": ogenregex.MustCompile("^[A-Za-z0-9_-]+$"),
|
||||
"^[a-z0-9][a-z0-9_.+#-]*$": ogenregex.MustCompile("^[a-z0-9][a-z0-9_.+#-]*$"),
|
||||
"^[a-z0-9_+-]+$": ogenregex.MustCompile("^[a-z0-9_+-]+$"),
|
||||
"^[a-z0-9_]+$": ogenregex.MustCompile("^[a-z0-9_]+$"),
|
||||
"^[a-z][a-z0-9_]*$": ogenregex.MustCompile("^[a-z][a-z0-9_]*$"),
|
||||
"^\\+[1-9][0-9]{6,14}$": ogenregex.MustCompile("^\\+[1-9][0-9]{6,14}$"),
|
||||
"^\\S(?:.*\\S)?$": ogenregex.MustCompile("^\\S(?:.*\\S)?$"),
|
||||
"^\\S(?:[^\\n\\r]*\\S)?$": ogenregex.MustCompile("^\\S(?:[^\\n\\r]*\\S)?$"),
|
||||
"^__Host-lincodex_session=": ogenregex.MustCompile("^__Host-lincodex_session="),
|
||||
"^cv1_[A-Za-z0-9_-]{43}$": ogenregex.MustCompile("^cv1_[A-Za-z0-9_-]{43}$"),
|
||||
"^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$": ogenregex.MustCompile("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$"),
|
||||
"\\S": ogenregex.MustCompile("\\S"),
|
||||
"^(/([^~/]|~[01])*)*$": ogenregex.MustCompile("^(/([^~/]|~[01])*)*$"),
|
||||
"^/[A-Za-z0-9/_-]{0,255}$": ogenregex.MustCompile("^/[A-Za-z0-9/_-]{0,255}$"),
|
||||
"^/api/v1/me/assessment-lab-consoles/[0-9a-f-]{36}$": ogenregex.MustCompile("^/api/v1/me/assessment-lab-consoles/[0-9a-f-]{36}$"),
|
||||
"^@[A-Za-z0-9_]{5,32}$": ogenregex.MustCompile("^@[A-Za-z0-9_]{5,32}$"),
|
||||
"^SC-[0-9]{4}-[0-9]{6,10}$": ogenregex.MustCompile("^SC-[0-9]{4}-[0-9]{6,10}$"),
|
||||
"^[0-9A-HJKMNP-TV-Z]{5}-?[0-9A-HJKMNP-TV-Z]{5}$": ogenregex.MustCompile("^[0-9A-HJKMNP-TV-Z]{5}-?[0-9A-HJKMNP-TV-Z]{5}$"),
|
||||
"^[0-9]{4}-(0[1-9]|1[0-2])$": ogenregex.MustCompile("^[0-9]{4}-(0[1-9]|1[0-2])$"),
|
||||
"^[0-9]{6}$": ogenregex.MustCompile("^[0-9]{6}$"),
|
||||
"^[A-Za-z0-9._-]+$": ogenregex.MustCompile("^[A-Za-z0-9._-]+$"),
|
||||
"^[A-Za-z0-9._:-]+$": ogenregex.MustCompile("^[A-Za-z0-9._:-]+$"),
|
||||
"^[A-Za-z0-9_-]+$": ogenregex.MustCompile("^[A-Za-z0-9_-]+$"),
|
||||
"^[a-z0-9][a-z0-9_.+#-]*$": ogenregex.MustCompile("^[a-z0-9][a-z0-9_.+#-]*$"),
|
||||
"^[a-z0-9_+-]+$": ogenregex.MustCompile("^[a-z0-9_+-]+$"),
|
||||
"^[a-z0-9_]+$": ogenregex.MustCompile("^[a-z0-9_]+$"),
|
||||
"^[a-z][a-z0-9-]{0,14}$": ogenregex.MustCompile("^[a-z][a-z0-9-]{0,14}$"),
|
||||
"^[a-z][a-z0-9_]*$": ogenregex.MustCompile("^[a-z][a-z0-9_]*$"),
|
||||
"^\\+[1-9][0-9]{6,14}$": ogenregex.MustCompile("^\\+[1-9][0-9]{6,14}$"),
|
||||
"^\\S(?:.*\\S)?$": ogenregex.MustCompile("^\\S(?:.*\\S)?$"),
|
||||
"^\\S(?:[^\\n\\r]*\\S)?$": ogenregex.MustCompile("^\\S(?:[^\\n\\r]*\\S)?$"),
|
||||
"^__Host-lincodex_session=": ogenregex.MustCompile("^__Host-lincodex_session="),
|
||||
"^cv1_[A-Za-z0-9_-]{43}$": ogenregex.MustCompile("^cv1_[A-Za-z0-9_-]{43}$"),
|
||||
"^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$": ogenregex.MustCompile("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$"),
|
||||
"^https://github\\.com/[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})/[A-Za-z0-9._-]{1,100}/?$": ogenregex.MustCompile("^https://github\\.com/[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})/[A-Za-z0-9._-]{1,100}/?$"),
|
||||
}
|
||||
var (
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -25,6 +25,14 @@ type CreateMyAssessmentAttemptRes interface {
|
||||
createMyAssessmentAttemptRes()
|
||||
}
|
||||
|
||||
type CreateMyAssessmentLabConsoleSessionRes interface {
|
||||
createMyAssessmentLabConsoleSessionRes()
|
||||
}
|
||||
|
||||
type CreateMyAssessmentLabRes interface {
|
||||
createMyAssessmentLabRes()
|
||||
}
|
||||
|
||||
type CreateMyAssessmentPracticeRunRes interface {
|
||||
createMyAssessmentPracticeRunRes()
|
||||
}
|
||||
@@ -73,6 +81,10 @@ type GetMyAssessmentAvailabilityRes interface {
|
||||
getMyAssessmentAvailabilityRes()
|
||||
}
|
||||
|
||||
type GetMyAssessmentLabRes interface {
|
||||
getMyAssessmentLabRes()
|
||||
}
|
||||
|
||||
type GetMyAssessmentPracticeRunRes interface {
|
||||
getMyAssessmentPracticeRunRes()
|
||||
}
|
||||
@@ -285,6 +297,10 @@ type SubmitMyAssessmentAnswerRes interface {
|
||||
submitMyAssessmentAnswerRes()
|
||||
}
|
||||
|
||||
type SubmitMyAssessmentLabRes interface {
|
||||
submitMyAssessmentLabRes()
|
||||
}
|
||||
|
||||
type UnhideOrganizationRes interface {
|
||||
unhideOrganizationRes()
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -12,6 +12,8 @@ const (
|
||||
ConfirmEmailOperation OperationName = "ConfirmEmail"
|
||||
ConfirmEmailByCodeOperation OperationName = "ConfirmEmailByCode"
|
||||
CreateMyAssessmentAttemptOperation OperationName = "CreateMyAssessmentAttempt"
|
||||
CreateMyAssessmentLabOperation OperationName = "CreateMyAssessmentLab"
|
||||
CreateMyAssessmentLabConsoleSessionOperation OperationName = "CreateMyAssessmentLabConsoleSession"
|
||||
CreateMyAssessmentPracticeRunOperation OperationName = "CreateMyAssessmentPracticeRun"
|
||||
CreateMySupportCaseOperation OperationName = "CreateMySupportCase"
|
||||
CreateOrganizationOperation OperationName = "CreateOrganization"
|
||||
@@ -25,6 +27,7 @@ const (
|
||||
GetHealthzOperation OperationName = "GetHealthz"
|
||||
GetMyAssessmentAttemptOperation OperationName = "GetMyAssessmentAttempt"
|
||||
GetMyAssessmentAvailabilityOperation OperationName = "GetMyAssessmentAvailability"
|
||||
GetMyAssessmentLabOperation OperationName = "GetMyAssessmentLab"
|
||||
GetMyAssessmentPracticeRunOperation OperationName = "GetMyAssessmentPracticeRun"
|
||||
GetMyAssessmentResultOperation OperationName = "GetMyAssessmentResult"
|
||||
GetMyAssessmentSignalNoticeOperation OperationName = "GetMyAssessmentSignalNotice"
|
||||
@@ -79,6 +82,7 @@ const (
|
||||
SetMySearchStatusOperation OperationName = "SetMySearchStatus"
|
||||
StartMyAssessmentAttemptSessionOperation OperationName = "StartMyAssessmentAttemptSession"
|
||||
SubmitMyAssessmentAnswerOperation OperationName = "SubmitMyAssessmentAnswer"
|
||||
SubmitMyAssessmentLabOperation OperationName = "SubmitMyAssessmentLab"
|
||||
UnhideOrganizationOperation OperationName = "UnhideOrganization"
|
||||
UpdateOrganizationOperation OperationName = "UpdateOrganization"
|
||||
UpdateOrganizationInvitationOperation OperationName = "UpdateOrganizationInvitation"
|
||||
|
||||
@@ -593,6 +593,276 @@ func decodeCreateMyAssessmentAttemptParams(args [0]string, argsEscaped bool, r *
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// CreateMyAssessmentLabParams is parameters of CreateMyAssessmentLab operation.
|
||||
type CreateMyAssessmentLabParams struct {
|
||||
// Identifier of an assessment attempt of the current candidate. An attempt of another candidate and an
|
||||
// unknown identifier both answer 404 not_found, so identifiers cannot be enumerated.
|
||||
AttemptID uuid.UUID
|
||||
// Client-generated key that makes a retried mutating command safe; a UUID v4 is recommended. The value
|
||||
// is sent without quotes. The server scopes the key by caller and operation and fingerprints the
|
||||
// request by method, path, and body.
|
||||
//
|
||||
// Stored for 24 hours after the first request and replayed with the same status, headers, and body:
|
||||
// the final 2xx outcome and final deterministic 4xx business outcomes of the command, such as 404
|
||||
// not_found or 409 state_conflict. A replay does not repeat the side effect.
|
||||
//
|
||||
// Not stored, so a retry with the same key is evaluated again: 400 validation_failed, 413, and 415 for
|
||||
// the request itself, 401 and 403, 409 idempotency_in_progress, 412 version_conflict and 428
|
||||
// precondition_required (nothing changed; read the resource again and retry), 422
|
||||
// idempotency_key_reused, 429, and every 5xx.
|
||||
//
|
||||
// Order of checks: authentication (401), request validation (400, 413, 415), authorization (403), then
|
||||
// the key. A stored or running request with a different fingerprint returns 422 idempotency_key_reused
|
||||
// before any other key check; a running request with the same fingerprint returns 409
|
||||
// idempotency_in_progress; a stored outcome with the same fingerprint is replayed. Only after that
|
||||
// does the server check If-Match, so a retry of a completed change replays its outcome instead of
|
||||
// failing on the version it has just changed. After 24 hours the key may be accepted as new.
|
||||
IdempotencyKey string
|
||||
}
|
||||
|
||||
func unpackCreateMyAssessmentLabParams(packed middleware.Parameters) (params CreateMyAssessmentLabParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "attempt_id",
|
||||
In: "path",
|
||||
}
|
||||
params.AttemptID = packed[key].(uuid.UUID)
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "Idempotency-Key",
|
||||
In: "header",
|
||||
}
|
||||
params.IdempotencyKey = packed[key].(string)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeCreateMyAssessmentLabParams(args [1]string, argsEscaped bool, r *http.Request) (params CreateMyAssessmentLabParams, _ error) {
|
||||
h := uri.NewHeaderDecoder(r.Header)
|
||||
// Decode path: attempt_id.
|
||||
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: "attempt_id",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToUUID(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.AttemptID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "attempt_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// Decode header: Idempotency-Key.
|
||||
if err := func() error {
|
||||
cfg := uri.HeaderParameterDecodingConfig{
|
||||
Name: "Idempotency-Key",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.HasParam(cfg); err == nil {
|
||||
if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToString(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.IdempotencyKey = c
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := (validate.String{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 255,
|
||||
MaxLengthSet: true,
|
||||
Email: false,
|
||||
Hostname: false,
|
||||
Regex: regexMap["^[A-Za-z0-9._:-]+$"],
|
||||
MinNumeric: 0,
|
||||
MinNumericSet: false,
|
||||
MaxNumeric: 0,
|
||||
MaxNumericSet: false,
|
||||
}).Validate(string(params.IdempotencyKey)); err != nil {
|
||||
return errors.Wrap(err, "string")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "Idempotency-Key",
|
||||
In: "header",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// CreateMyAssessmentLabConsoleSessionParams is parameters of CreateMyAssessmentLabConsoleSession operation.
|
||||
type CreateMyAssessmentLabConsoleSessionParams struct {
|
||||
// Identifier of an assessment attempt of the current candidate. An attempt of another candidate and an
|
||||
// unknown identifier both answer 404 not_found, so identifiers cannot be enumerated.
|
||||
AttemptID uuid.UUID
|
||||
// Identifier of a lab of this attempt.
|
||||
LabID uuid.UUID
|
||||
}
|
||||
|
||||
func unpackCreateMyAssessmentLabConsoleSessionParams(packed middleware.Parameters) (params CreateMyAssessmentLabConsoleSessionParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "attempt_id",
|
||||
In: "path",
|
||||
}
|
||||
params.AttemptID = packed[key].(uuid.UUID)
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "lab_id",
|
||||
In: "path",
|
||||
}
|
||||
params.LabID = packed[key].(uuid.UUID)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeCreateMyAssessmentLabConsoleSessionParams(args [2]string, argsEscaped bool, r *http.Request) (params CreateMyAssessmentLabConsoleSessionParams, _ error) {
|
||||
// Decode path: attempt_id.
|
||||
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: "attempt_id",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToUUID(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.AttemptID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "attempt_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// Decode path: lab_id.
|
||||
if err := func() error {
|
||||
param := args[1]
|
||||
if argsEscaped {
|
||||
unescaped, err := url.PathUnescape(args[1])
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unescape path")
|
||||
}
|
||||
param = unescaped
|
||||
}
|
||||
if len(param) > 0 {
|
||||
d := uri.NewPathDecoder(uri.PathDecoderConfig{
|
||||
Param: "lab_id",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToUUID(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.LabID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "lab_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// CreateMyAssessmentPracticeRunParams is parameters of CreateMyAssessmentPracticeRun operation.
|
||||
type CreateMyAssessmentPracticeRunParams struct {
|
||||
// Identifier of an assessment attempt of the current candidate. An attempt of another candidate and an
|
||||
@@ -1672,6 +1942,127 @@ func decodeGetMyAssessmentAttemptParams(args [1]string, argsEscaped bool, r *htt
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// GetMyAssessmentLabParams is parameters of GetMyAssessmentLab operation.
|
||||
type GetMyAssessmentLabParams struct {
|
||||
// Identifier of an assessment attempt of the current candidate. An attempt of another candidate and an
|
||||
// unknown identifier both answer 404 not_found, so identifiers cannot be enumerated.
|
||||
AttemptID uuid.UUID
|
||||
// Identifier of a lab of this attempt.
|
||||
LabID uuid.UUID
|
||||
}
|
||||
|
||||
func unpackGetMyAssessmentLabParams(packed middleware.Parameters) (params GetMyAssessmentLabParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "attempt_id",
|
||||
In: "path",
|
||||
}
|
||||
params.AttemptID = packed[key].(uuid.UUID)
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "lab_id",
|
||||
In: "path",
|
||||
}
|
||||
params.LabID = packed[key].(uuid.UUID)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeGetMyAssessmentLabParams(args [2]string, argsEscaped bool, r *http.Request) (params GetMyAssessmentLabParams, _ error) {
|
||||
// Decode path: attempt_id.
|
||||
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: "attempt_id",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToUUID(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.AttemptID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "attempt_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// Decode path: lab_id.
|
||||
if err := func() error {
|
||||
param := args[1]
|
||||
if argsEscaped {
|
||||
unescaped, err := url.PathUnescape(args[1])
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unescape path")
|
||||
}
|
||||
param = unescaped
|
||||
}
|
||||
if len(param) > 0 {
|
||||
d := uri.NewPathDecoder(uri.PathDecoderConfig{
|
||||
Param: "lab_id",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToUUID(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.LabID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "lab_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// GetMyAssessmentPracticeRunParams is parameters of GetMyAssessmentPracticeRun operation.
|
||||
type GetMyAssessmentPracticeRunParams struct {
|
||||
// Identifier of an assessment attempt of the current candidate. An attempt of another candidate and an
|
||||
@@ -7249,6 +7640,209 @@ func decodeSubmitMyAssessmentAnswerParams(args [1]string, argsEscaped bool, r *h
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// SubmitMyAssessmentLabParams is parameters of SubmitMyAssessmentLab operation.
|
||||
type SubmitMyAssessmentLabParams struct {
|
||||
// Identifier of an assessment attempt of the current candidate. An attempt of another candidate and an
|
||||
// unknown identifier both answer 404 not_found, so identifiers cannot be enumerated.
|
||||
AttemptID uuid.UUID
|
||||
// Client-generated key that makes a retried mutating command safe; a UUID v4 is recommended. The value
|
||||
// is sent without quotes. The server scopes the key by caller and operation and fingerprints the
|
||||
// request by method, path, and body.
|
||||
//
|
||||
// Stored for 24 hours after the first request and replayed with the same status, headers, and body:
|
||||
// the final 2xx outcome and final deterministic 4xx business outcomes of the command, such as 404
|
||||
// not_found or 409 state_conflict. A replay does not repeat the side effect.
|
||||
//
|
||||
// Not stored, so a retry with the same key is evaluated again: 400 validation_failed, 413, and 415 for
|
||||
// the request itself, 401 and 403, 409 idempotency_in_progress, 412 version_conflict and 428
|
||||
// precondition_required (nothing changed; read the resource again and retry), 422
|
||||
// idempotency_key_reused, 429, and every 5xx.
|
||||
//
|
||||
// Order of checks: authentication (401), request validation (400, 413, 415), authorization (403), then
|
||||
// the key. A stored or running request with a different fingerprint returns 422 idempotency_key_reused
|
||||
// before any other key check; a running request with the same fingerprint returns 409
|
||||
// idempotency_in_progress; a stored outcome with the same fingerprint is replayed. Only after that
|
||||
// does the server check If-Match, so a retry of a completed change replays its outcome instead of
|
||||
// failing on the version it has just changed. After 24 hours the key may be accepted as new.
|
||||
IdempotencyKey string
|
||||
// Identifier of the lab to submit.
|
||||
LabID uuid.UUID
|
||||
}
|
||||
|
||||
func unpackSubmitMyAssessmentLabParams(packed middleware.Parameters) (params SubmitMyAssessmentLabParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "attempt_id",
|
||||
In: "path",
|
||||
}
|
||||
params.AttemptID = packed[key].(uuid.UUID)
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "Idempotency-Key",
|
||||
In: "header",
|
||||
}
|
||||
params.IdempotencyKey = packed[key].(string)
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "lab_id",
|
||||
In: "path",
|
||||
}
|
||||
params.LabID = packed[key].(uuid.UUID)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeSubmitMyAssessmentLabParams(args [2]string, argsEscaped bool, r *http.Request) (params SubmitMyAssessmentLabParams, _ error) {
|
||||
h := uri.NewHeaderDecoder(r.Header)
|
||||
// Decode path: attempt_id.
|
||||
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: "attempt_id",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToUUID(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.AttemptID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "attempt_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// Decode header: Idempotency-Key.
|
||||
if err := func() error {
|
||||
cfg := uri.HeaderParameterDecodingConfig{
|
||||
Name: "Idempotency-Key",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.HasParam(cfg); err == nil {
|
||||
if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToString(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.IdempotencyKey = c
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := (validate.String{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 255,
|
||||
MaxLengthSet: true,
|
||||
Email: false,
|
||||
Hostname: false,
|
||||
Regex: regexMap["^[A-Za-z0-9._:-]+$"],
|
||||
MinNumeric: 0,
|
||||
MinNumericSet: false,
|
||||
MaxNumeric: 0,
|
||||
MaxNumericSet: false,
|
||||
}).Validate(string(params.IdempotencyKey)); err != nil {
|
||||
return errors.Wrap(err, "string")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "Idempotency-Key",
|
||||
In: "header",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// Decode path: lab_id.
|
||||
if err := func() error {
|
||||
param := args[1]
|
||||
if argsEscaped {
|
||||
unescaped, err := url.PathUnescape(args[1])
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unescape path")
|
||||
}
|
||||
param = unescaped
|
||||
}
|
||||
if len(param) > 0 {
|
||||
d := uri.NewPathDecoder(uri.PathDecoderConfig{
|
||||
Param: "lab_id",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToUUID(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.LabID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "lab_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// UnhideOrganizationParams is parameters of UnhideOrganization operation.
|
||||
type UnhideOrganizationParams struct {
|
||||
// Identifier of the organization that the current candidate hides or stops hiding the profile from. It
|
||||
|
||||
@@ -488,6 +488,156 @@ func (s *Server) decodeCreateMyAssessmentAttemptRequest(r *http.Request) (
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeCreateMyAssessmentLabRequest(r *http.Request) (
|
||||
req *AssessmentLabCreate,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request AssessmentLabCreate
|
||||
if err := func() error {
|
||||
if err := request.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 req, rawBody, close, err
|
||||
}
|
||||
return &request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeCreateMyAssessmentLabConsoleSessionRequest(r *http.Request) (
|
||||
req *AssessmentLabConsoleSessionCreate,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request AssessmentLabConsoleSessionCreate
|
||||
if err := func() error {
|
||||
if err := request.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 req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return &request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeCreateMyAssessmentPracticeRunRequest(r *http.Request) (
|
||||
req *PracticeRunCreate,
|
||||
rawBody []byte,
|
||||
@@ -2147,6 +2297,85 @@ func (s *Server) decodeSubmitMyAssessmentAnswerRequest(r *http.Request) (
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeSubmitMyAssessmentLabRequest(r *http.Request) (
|
||||
req *AssessmentLabSubmission,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request AssessmentLabSubmission
|
||||
if err := func() error {
|
||||
if err := request.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 req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return &request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeUpdateOrganizationRequest(r *http.Request) (
|
||||
req *OrganizationUpdate,
|
||||
rawBody []byte,
|
||||
|
||||
@@ -676,6 +676,366 @@ func encodeCreateMyAssessmentAttemptResponse(response CreateMyAssessmentAttemptR
|
||||
}
|
||||
}
|
||||
|
||||
func encodeCreateMyAssessmentLabResponse(response CreateMyAssessmentLabRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *CreateMyAssessmentLabOK:
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Cache-Control" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Cache-Control",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Cache-Control header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(200)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabCreated:
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Cache-Control" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Cache-Control",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Cache-Control header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(201)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabBadRequest:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(400)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabUnauthorized:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(401)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabForbidden:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(403)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabNotFound:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(404)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabConflict:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(409)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabUnprocessableEntity:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(422)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *TooManyRequestsHeaders:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Retry-After" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Retry-After",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
if val, ok := response.RetryAfter.Get(); ok {
|
||||
return e.EncodeValue(conv.Int32ToString(val))
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Retry-After header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(429)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *ServiceUnavailableHeaders:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Retry-After" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Retry-After",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
if val, ok := response.RetryAfter.Get(); ok {
|
||||
return e.EncodeValue(conv.Int32ToString(val))
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Retry-After header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(503)
|
||||
span.SetStatus(codes.Error, http.StatusText(503))
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeCreateMyAssessmentLabConsoleSessionResponse(response CreateMyAssessmentLabConsoleSessionRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *AssessmentLabConsoleSessionHeaders:
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Cache-Control" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Cache-Control",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Cache-Control header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(201)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabConsoleSessionBadRequest:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(400)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabConsoleSessionUnauthorized:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(401)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabConsoleSessionForbidden:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(403)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabConsoleSessionNotFound:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(404)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMyAssessmentLabConsoleSessionConflict:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(409)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *TooManyRequestsHeaders:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Retry-After" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Retry-After",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
if val, ok := response.RetryAfter.Get(); ok {
|
||||
return e.EncodeValue(conv.Int32ToString(val))
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Retry-After header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(429)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *ServiceUnavailableHeaders:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Retry-After" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Retry-After",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
if val, ok := response.RetryAfter.Get(); ok {
|
||||
return e.EncodeValue(conv.Int32ToString(val))
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Retry-After header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(503)
|
||||
span.SetStatus(codes.Error, http.StatusText(503))
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeCreateMyAssessmentPracticeRunResponse(response CreateMyAssessmentPracticeRunRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *PracticeRunHeaders:
|
||||
@@ -1930,6 +2290,77 @@ func encodeGetMyAssessmentAvailabilityResponse(response GetMyAssessmentAvailabil
|
||||
}
|
||||
}
|
||||
|
||||
func encodeGetMyAssessmentLabResponse(response GetMyAssessmentLabRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *AssessmentLabHeaders:
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Cache-Control" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Cache-Control",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Cache-Control header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(200)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *GetMyAssessmentLabUnauthorized:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(401)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *GetMyAssessmentLabForbidden:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(403)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *GetMyAssessmentLabNotFound:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(404)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeGetMyAssessmentPracticeRunResponse(response GetMyAssessmentPracticeRunRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *PracticeRunHeaders:
|
||||
@@ -6465,6 +6896,190 @@ func encodeSubmitMyAssessmentAnswerResponse(response SubmitMyAssessmentAnswerRes
|
||||
}
|
||||
}
|
||||
|
||||
func encodeSubmitMyAssessmentLabResponse(response SubmitMyAssessmentLabRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *AssessmentLabHeaders:
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Cache-Control" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Cache-Control",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Cache-Control header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(202)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SubmitMyAssessmentLabBadRequest:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(400)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SubmitMyAssessmentLabUnauthorized:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(401)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SubmitMyAssessmentLabForbidden:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(403)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SubmitMyAssessmentLabNotFound:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(404)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SubmitMyAssessmentLabConflict:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(409)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SubmitMyAssessmentLabPreconditionFailed:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(412)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SubmitMyAssessmentLabUnprocessableEntity:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(422)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *TooManyRequestsHeaders:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Retry-After" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Retry-After",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
if val, ok := response.RetryAfter.Get(); ok {
|
||||
return e.EncodeValue(conv.Int32ToString(val))
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Retry-After header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(429)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *ServiceUnavailableHeaders:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Retry-After" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Retry-After",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
if val, ok := response.RetryAfter.Get(); ok {
|
||||
return e.EncodeValue(conv.Int32ToString(val))
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Retry-After header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(503)
|
||||
span.SetStatus(codes.Error, http.StatusText(503))
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeUnhideOrganizationResponse(response UnhideOrganizationRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *UnhideOrganizationNoContent:
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
rn89AllowedHeaders = map[string]string{
|
||||
rn93AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type",
|
||||
}
|
||||
rn9AllowedHeaders = map[string]string{
|
||||
@@ -20,47 +20,56 @@ var (
|
||||
rn10AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Origin",
|
||||
}
|
||||
rn84AllowedHeaders = map[string]string{
|
||||
rn88AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key",
|
||||
}
|
||||
rn74AllowedHeaders = map[string]string{
|
||||
rn78AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type",
|
||||
}
|
||||
rn30AllowedHeaders = map[string]string{
|
||||
rn34AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
}
|
||||
rn86AllowedHeaders = map[string]string{
|
||||
rn90AllowedHeaders = map[string]string{
|
||||
"POST": "X-Csrf-Token",
|
||||
}
|
||||
rn12AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn100AllowedHeaders = map[string]string{
|
||||
rn104AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Attempt-Client,X-Csrf-Token",
|
||||
}
|
||||
rn25AllowedHeaders = map[string]string{
|
||||
rn29AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn15AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn99AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Attempt-Client,X-Csrf-Token",
|
||||
rn18AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn83AllowedHeaders = map[string]string{
|
||||
rn106AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn61AllowedHeaders = map[string]string{
|
||||
rn20AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn103AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Attempt-Client,X-Csrf-Token",
|
||||
}
|
||||
rn87AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn65AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Attempt-Client,X-Csrf-Token",
|
||||
"PUT": "X-Attempt-Client,X-Csrf-Token",
|
||||
}
|
||||
rn5AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn91AllowedHeaders = map[string]string{
|
||||
rn95AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
}
|
||||
rn57AllowedHeaders = map[string]string{
|
||||
rn61AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
@@ -70,68 +79,68 @@ var (
|
||||
rn7AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn23AllowedHeaders = map[string]string{
|
||||
rn28AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn101AllowedHeaders = map[string]string{
|
||||
rn107AllowedHeaders = map[string]string{
|
||||
"POST": "X-Csrf-Token",
|
||||
}
|
||||
rn77AllowedHeaders = map[string]string{
|
||||
rn81AllowedHeaders = map[string]string{
|
||||
"POST": "X-Csrf-Token",
|
||||
}
|
||||
rn60AllowedHeaders = map[string]string{
|
||||
rn64AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
"PUT": "X-Csrf-Token",
|
||||
}
|
||||
rn96AllowedHeaders = map[string]string{
|
||||
rn100AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn97AllowedHeaders = map[string]string{
|
||||
rn101AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn42AllowedHeaders = map[string]string{
|
||||
rn46AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn87AllowedHeaders = map[string]string{
|
||||
rn91AllowedHeaders = map[string]string{
|
||||
"POST": "X-Csrf-Token",
|
||||
}
|
||||
rn43AllowedHeaders = map[string]string{
|
||||
rn47AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn16AllowedHeaders = map[string]string{
|
||||
rn21AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn17AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn19AllowedHeaders = map[string]string{
|
||||
"PATCH": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn20AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn50AllowedHeaders = map[string]string{
|
||||
"PATCH": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn82AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn94AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn102AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn92AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn22AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn53AllowedHeaders = map[string]string{
|
||||
rn24AllowedHeaders = map[string]string{
|
||||
"PATCH": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn80AllowedHeaders = map[string]string{
|
||||
rn25AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn54AllowedHeaders = map[string]string{
|
||||
"PATCH": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn86AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn98AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn108AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn96AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn27AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn57AllowedHeaders = map[string]string{
|
||||
"PATCH": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn84AllowedHeaders = map[string]string{
|
||||
"POST": "X-Csrf-Token",
|
||||
}
|
||||
)
|
||||
@@ -288,7 +297,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn89AllowedHeaders,
|
||||
allowedHeaders: rn93AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -391,7 +400,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn84AllowedHeaders,
|
||||
allowedHeaders: rn88AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -415,7 +424,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn74AllowedHeaders,
|
||||
allowedHeaders: rn78AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -442,7 +451,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "DELETE,GET",
|
||||
allowedHeaders: rn30AllowedHeaders,
|
||||
allowedHeaders: rn34AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -495,7 +504,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn86AllowedHeaders,
|
||||
allowedHeaders: rn90AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -617,7 +626,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn100AllowedHeaders,
|
||||
allowedHeaders: rn104AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -644,7 +653,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn25AllowedHeaders,
|
||||
allowedHeaders: rn29AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -653,6 +662,142 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
case 'l': // Prefix: "labs"
|
||||
|
||||
if l := len("labs"); len(elem) >= l && elem[0:l] == "labs" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
switch r.Method {
|
||||
case "POST":
|
||||
s.handleCreateMyAssessmentLabRequest([1]string{
|
||||
args[0],
|
||||
}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn15AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
switch elem[0] {
|
||||
case '/': // Prefix: "/"
|
||||
|
||||
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
// Param: "lab_id"
|
||||
// Match until "/"
|
||||
idx := strings.IndexByte(elem, '/')
|
||||
if idx < 0 {
|
||||
idx = len(elem)
|
||||
}
|
||||
args[1] = elem[:idx]
|
||||
elem = elem[idx:]
|
||||
|
||||
if len(elem) == 0 {
|
||||
switch r.Method {
|
||||
case "GET":
|
||||
s.handleGetMyAssessmentLabRequest([2]string{
|
||||
args[0],
|
||||
args[1],
|
||||
}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET",
|
||||
allowedHeaders: nil,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
switch elem[0] {
|
||||
case '/': // Prefix: "/"
|
||||
|
||||
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
break
|
||||
}
|
||||
switch elem[0] {
|
||||
case 'c': // Prefix: "console-sessions"
|
||||
|
||||
if l := len("console-sessions"); len(elem) >= l && elem[0:l] == "console-sessions" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch r.Method {
|
||||
case "POST":
|
||||
s.handleCreateMyAssessmentLabConsoleSessionRequest([2]string{
|
||||
args[0],
|
||||
args[1],
|
||||
}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn18AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
case 's': // Prefix: "submission"
|
||||
|
||||
if l := len("submission"); len(elem) >= l && elem[0:l] == "submission" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch r.Method {
|
||||
case "POST":
|
||||
s.handleSubmitMyAssessmentLabRequest([2]string{
|
||||
args[0],
|
||||
args[1],
|
||||
}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn106AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case 'p': // Prefix: "practice-runs"
|
||||
|
||||
if l := len("practice-runs"); len(elem) >= l && elem[0:l] == "practice-runs" {
|
||||
@@ -670,7 +815,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn15AllowedHeaders,
|
||||
allowedHeaders: rn20AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -775,7 +920,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn99AllowedHeaders,
|
||||
allowedHeaders: rn103AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -802,7 +947,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn83AllowedHeaders,
|
||||
allowedHeaders: rn87AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -835,7 +980,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "DELETE,PUT",
|
||||
allowedHeaders: rn61AllowedHeaders,
|
||||
allowedHeaders: rn65AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1044,7 +1189,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "DELETE",
|
||||
allowedHeaders: rn91AllowedHeaders,
|
||||
allowedHeaders: rn95AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1078,7 +1223,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "DELETE,PUT",
|
||||
allowedHeaders: rn57AllowedHeaders,
|
||||
allowedHeaders: rn61AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1259,7 +1404,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn23AllowedHeaders,
|
||||
allowedHeaders: rn28AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1286,7 +1431,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn101AllowedHeaders,
|
||||
allowedHeaders: rn107AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1364,7 +1509,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn77AllowedHeaders,
|
||||
allowedHeaders: rn81AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1542,7 +1687,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "DELETE,PUT",
|
||||
allowedHeaders: rn60AllowedHeaders,
|
||||
allowedHeaders: rn64AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1633,7 +1778,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "PUT",
|
||||
allowedHeaders: rn96AllowedHeaders,
|
||||
allowedHeaders: rn100AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1660,7 +1805,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "PUT",
|
||||
allowedHeaders: rn97AllowedHeaders,
|
||||
allowedHeaders: rn101AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1690,7 +1835,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,PUT",
|
||||
allowedHeaders: rn42AllowedHeaders,
|
||||
allowedHeaders: rn46AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1715,7 +1860,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn87AllowedHeaders,
|
||||
allowedHeaders: rn91AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1746,7 +1891,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,PUT",
|
||||
allowedHeaders: rn43AllowedHeaders,
|
||||
allowedHeaders: rn47AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1772,7 +1917,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,POST",
|
||||
allowedHeaders: rn16AllowedHeaders,
|
||||
allowedHeaders: rn21AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1836,7 +1981,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn17AllowedHeaders,
|
||||
allowedHeaders: rn22AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1875,7 +2020,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,PATCH",
|
||||
allowedHeaders: rn19AllowedHeaders,
|
||||
allowedHeaders: rn24AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "application/json",
|
||||
})
|
||||
@@ -1983,7 +2128,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,POST",
|
||||
allowedHeaders: rn20AllowedHeaders,
|
||||
allowedHeaders: rn25AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -2024,7 +2169,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,PATCH",
|
||||
allowedHeaders: rn50AllowedHeaders,
|
||||
allowedHeaders: rn54AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "application/json",
|
||||
})
|
||||
@@ -2104,7 +2249,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn82AllowedHeaders,
|
||||
allowedHeaders: rn86AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -2132,7 +2277,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn94AllowedHeaders,
|
||||
allowedHeaders: rn98AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -2162,7 +2307,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn102AllowedHeaders,
|
||||
allowedHeaders: rn108AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -2195,7 +2340,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn92AllowedHeaders,
|
||||
allowedHeaders: rn96AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -2237,7 +2382,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,POST",
|
||||
allowedHeaders: rn22AllowedHeaders,
|
||||
allowedHeaders: rn27AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -2279,7 +2424,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,PATCH",
|
||||
allowedHeaders: rn53AllowedHeaders,
|
||||
allowedHeaders: rn57AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "application/json",
|
||||
})
|
||||
@@ -2356,7 +2501,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn80AllowedHeaders,
|
||||
allowedHeaders: rn84AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -2967,6 +3112,131 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
}
|
||||
}
|
||||
|
||||
case 'l': // Prefix: "labs"
|
||||
|
||||
if l := len("labs"); len(elem) >= l && elem[0:l] == "labs" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
switch method {
|
||||
case "POST":
|
||||
r.name = CreateMyAssessmentLabOperation
|
||||
r.summary = "Start the lab of the current lab item of an assessment attempt."
|
||||
r.operationID = "CreateMyAssessmentLab"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/me/assessment-attempts/{attempt_id}/labs"
|
||||
r.args = args
|
||||
r.count = 1
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
switch elem[0] {
|
||||
case '/': // Prefix: "/"
|
||||
|
||||
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
// Param: "lab_id"
|
||||
// Match until "/"
|
||||
idx := strings.IndexByte(elem, '/')
|
||||
if idx < 0 {
|
||||
idx = len(elem)
|
||||
}
|
||||
args[1] = elem[:idx]
|
||||
elem = elem[idx:]
|
||||
|
||||
if len(elem) == 0 {
|
||||
switch method {
|
||||
case "GET":
|
||||
r.name = GetMyAssessmentLabOperation
|
||||
r.summary = "Read the lab of an assessment attempt item."
|
||||
r.operationID = "GetMyAssessmentLab"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/me/assessment-attempts/{attempt_id}/labs/{lab_id}"
|
||||
r.args = args
|
||||
r.count = 2
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
switch elem[0] {
|
||||
case '/': // Prefix: "/"
|
||||
|
||||
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
break
|
||||
}
|
||||
switch elem[0] {
|
||||
case 'c': // Prefix: "console-sessions"
|
||||
|
||||
if l := len("console-sessions"); len(elem) >= l && elem[0:l] == "console-sessions" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch method {
|
||||
case "POST":
|
||||
r.name = CreateMyAssessmentLabConsoleSessionOperation
|
||||
r.summary = "Open a console session of one node of a ready lab."
|
||||
r.operationID = "CreateMyAssessmentLabConsoleSession"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/me/assessment-attempts/{attempt_id}/labs/{lab_id}/console-sessions"
|
||||
r.args = args
|
||||
r.count = 2
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 's': // Prefix: "submission"
|
||||
|
||||
if l := len("submission"); len(elem) >= l && elem[0:l] == "submission" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch method {
|
||||
case "POST":
|
||||
r.name = SubmitMyAssessmentLabOperation
|
||||
r.summary = "Submit the lab of the current lab item as its answer."
|
||||
r.operationID = "SubmitMyAssessmentLab"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/me/assessment-attempts/{attempt_id}/labs/{lab_id}/submission"
|
||||
r.args = args
|
||||
r.count = 2
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case 'p': // Prefix: "practice-runs"
|
||||
|
||||
if l := len("practice-runs"); len(elem) >= l && elem[0:l] == "practice-runs" {
|
||||
|
||||
@@ -3610,6 +3610,488 @@ func (s *AssessmentItem) SetContent(val ItemContent) {
|
||||
|
||||
type AssessmentItemId uuid.UUID
|
||||
|
||||
// Candidate view of the lab of one attempt item. It contains no node address, MAC address, port,
|
||||
// password, key, token, seed, checker state, criteria, score, or infrastructure name.
|
||||
// Ref: #/components/schemas/AssessmentLab
|
||||
type AssessmentLab struct {
|
||||
// Identifier of the lab.
|
||||
ID uuid.UUID `json:"id"`
|
||||
ItemID AssessmentItemId `json:"item_id"`
|
||||
State AssessmentLabState `json:"state"`
|
||||
Nodes []AssessmentLabNode `json:"nodes"`
|
||||
CreatedAt Timestamp `json:"created_at"`
|
||||
// Time the lab became `ready`, or null before.
|
||||
ReadyAt NilTimestamp `json:"ready_at"`
|
||||
// Time the lab ends unless it was submitted before: the earlier of the lifetime of the item and the
|
||||
// attempt deadline. It never moves.
|
||||
ExpiresAt Timestamp `json:"expires_at"`
|
||||
// Time the lab reached `submitted`, `expired`, or `failed`, or null.
|
||||
FinishedAt NilTimestamp `json:"finished_at"`
|
||||
// `lab_error` when `state` is `failed`, otherwise null.
|
||||
FailureReason NilAssessmentLabFailureReason `json:"failure_reason"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *AssessmentLab) GetID() uuid.UUID {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetItemID returns the value of ItemID.
|
||||
func (s *AssessmentLab) GetItemID() AssessmentItemId {
|
||||
return s.ItemID
|
||||
}
|
||||
|
||||
// GetState returns the value of State.
|
||||
func (s *AssessmentLab) GetState() AssessmentLabState {
|
||||
return s.State
|
||||
}
|
||||
|
||||
// GetNodes returns the value of Nodes.
|
||||
func (s *AssessmentLab) GetNodes() []AssessmentLabNode {
|
||||
return s.Nodes
|
||||
}
|
||||
|
||||
// GetCreatedAt returns the value of CreatedAt.
|
||||
func (s *AssessmentLab) GetCreatedAt() Timestamp {
|
||||
return s.CreatedAt
|
||||
}
|
||||
|
||||
// GetReadyAt returns the value of ReadyAt.
|
||||
func (s *AssessmentLab) GetReadyAt() NilTimestamp {
|
||||
return s.ReadyAt
|
||||
}
|
||||
|
||||
// GetExpiresAt returns the value of ExpiresAt.
|
||||
func (s *AssessmentLab) GetExpiresAt() Timestamp {
|
||||
return s.ExpiresAt
|
||||
}
|
||||
|
||||
// GetFinishedAt returns the value of FinishedAt.
|
||||
func (s *AssessmentLab) GetFinishedAt() NilTimestamp {
|
||||
return s.FinishedAt
|
||||
}
|
||||
|
||||
// GetFailureReason returns the value of FailureReason.
|
||||
func (s *AssessmentLab) GetFailureReason() NilAssessmentLabFailureReason {
|
||||
return s.FailureReason
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *AssessmentLab) SetID(val uuid.UUID) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetItemID sets the value of ItemID.
|
||||
func (s *AssessmentLab) SetItemID(val AssessmentItemId) {
|
||||
s.ItemID = val
|
||||
}
|
||||
|
||||
// SetState sets the value of State.
|
||||
func (s *AssessmentLab) SetState(val AssessmentLabState) {
|
||||
s.State = val
|
||||
}
|
||||
|
||||
// SetNodes sets the value of Nodes.
|
||||
func (s *AssessmentLab) SetNodes(val []AssessmentLabNode) {
|
||||
s.Nodes = val
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the value of CreatedAt.
|
||||
func (s *AssessmentLab) SetCreatedAt(val Timestamp) {
|
||||
s.CreatedAt = val
|
||||
}
|
||||
|
||||
// SetReadyAt sets the value of ReadyAt.
|
||||
func (s *AssessmentLab) SetReadyAt(val NilTimestamp) {
|
||||
s.ReadyAt = val
|
||||
}
|
||||
|
||||
// SetExpiresAt sets the value of ExpiresAt.
|
||||
func (s *AssessmentLab) SetExpiresAt(val Timestamp) {
|
||||
s.ExpiresAt = val
|
||||
}
|
||||
|
||||
// SetFinishedAt sets the value of FinishedAt.
|
||||
func (s *AssessmentLab) SetFinishedAt(val NilTimestamp) {
|
||||
s.FinishedAt = val
|
||||
}
|
||||
|
||||
// SetFailureReason sets the value of FailureReason.
|
||||
func (s *AssessmentLab) SetFailureReason(val NilAssessmentLabFailureReason) {
|
||||
s.FailureReason = val
|
||||
}
|
||||
|
||||
// A console session of one node. The client opens a WebSocket to `websocket_path` on the same origin
|
||||
// before `expires_at`; the session cookie and the Origin check authorize the upgrade, so no secret
|
||||
// travels in the path, the body, or a query string. A session can be attached once and ends with the
|
||||
// lab.
|
||||
// Ref: #/components/schemas/AssessmentLabConsoleSession
|
||||
type AssessmentLabConsoleSession struct {
|
||||
// Identifier of the console session; it is not a secret.
|
||||
ID uuid.UUID `json:"id"`
|
||||
Node AssessmentLabNodeName `json:"node"`
|
||||
// Same-origin path of the console WebSocket.
|
||||
WebsocketPath string `json:"websocket_path"`
|
||||
// Time by which the WebSocket must be opened.
|
||||
ExpiresAt Timestamp `json:"expires_at"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *AssessmentLabConsoleSession) GetID() uuid.UUID {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetNode returns the value of Node.
|
||||
func (s *AssessmentLabConsoleSession) GetNode() AssessmentLabNodeName {
|
||||
return s.Node
|
||||
}
|
||||
|
||||
// GetWebsocketPath returns the value of WebsocketPath.
|
||||
func (s *AssessmentLabConsoleSession) GetWebsocketPath() string {
|
||||
return s.WebsocketPath
|
||||
}
|
||||
|
||||
// GetExpiresAt returns the value of ExpiresAt.
|
||||
func (s *AssessmentLabConsoleSession) GetExpiresAt() Timestamp {
|
||||
return s.ExpiresAt
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *AssessmentLabConsoleSession) SetID(val uuid.UUID) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetNode sets the value of Node.
|
||||
func (s *AssessmentLabConsoleSession) SetNode(val AssessmentLabNodeName) {
|
||||
s.Node = val
|
||||
}
|
||||
|
||||
// SetWebsocketPath sets the value of WebsocketPath.
|
||||
func (s *AssessmentLabConsoleSession) SetWebsocketPath(val string) {
|
||||
s.WebsocketPath = val
|
||||
}
|
||||
|
||||
// SetExpiresAt sets the value of ExpiresAt.
|
||||
func (s *AssessmentLabConsoleSession) SetExpiresAt(val Timestamp) {
|
||||
s.ExpiresAt = val
|
||||
}
|
||||
|
||||
// Open a console of one node of a ready lab. Unknown fields are rejected.
|
||||
// Ref: #/components/schemas/AssessmentLabConsoleSessionCreate
|
||||
type AssessmentLabConsoleSessionCreate struct {
|
||||
Node AssessmentLabNodeName `json:"node"`
|
||||
}
|
||||
|
||||
// GetNode returns the value of Node.
|
||||
func (s *AssessmentLabConsoleSessionCreate) GetNode() AssessmentLabNodeName {
|
||||
return s.Node
|
||||
}
|
||||
|
||||
// SetNode sets the value of Node.
|
||||
func (s *AssessmentLabConsoleSessionCreate) SetNode(val AssessmentLabNodeName) {
|
||||
s.Node = val
|
||||
}
|
||||
|
||||
// AssessmentLabConsoleSessionHeaders wraps AssessmentLabConsoleSession with response headers.
|
||||
type AssessmentLabConsoleSessionHeaders struct {
|
||||
CacheControl CacheControlNoStore
|
||||
Response AssessmentLabConsoleSession
|
||||
}
|
||||
|
||||
// GetCacheControl returns the value of CacheControl.
|
||||
func (s *AssessmentLabConsoleSessionHeaders) GetCacheControl() CacheControlNoStore {
|
||||
return s.CacheControl
|
||||
}
|
||||
|
||||
// GetResponse returns the value of Response.
|
||||
func (s *AssessmentLabConsoleSessionHeaders) GetResponse() AssessmentLabConsoleSession {
|
||||
return s.Response
|
||||
}
|
||||
|
||||
// SetCacheControl sets the value of CacheControl.
|
||||
func (s *AssessmentLabConsoleSessionHeaders) SetCacheControl(val CacheControlNoStore) {
|
||||
s.CacheControl = val
|
||||
}
|
||||
|
||||
// SetResponse sets the value of Response.
|
||||
func (s *AssessmentLabConsoleSessionHeaders) SetResponse(val AssessmentLabConsoleSession) {
|
||||
s.Response = val
|
||||
}
|
||||
|
||||
func (*AssessmentLabConsoleSessionHeaders) createMyAssessmentLabConsoleSessionRes() {}
|
||||
|
||||
// Start the lab of the current lab item. Unknown fields are rejected.
|
||||
// Ref: #/components/schemas/AssessmentLabCreate
|
||||
type AssessmentLabCreate struct {
|
||||
ItemID AssessmentItemId `json:"item_id"`
|
||||
}
|
||||
|
||||
// GetItemID returns the value of ItemID.
|
||||
func (s *AssessmentLabCreate) GetItemID() AssessmentItemId {
|
||||
return s.ItemID
|
||||
}
|
||||
|
||||
// SetItemID sets the value of ItemID.
|
||||
func (s *AssessmentLabCreate) SetItemID(val AssessmentItemId) {
|
||||
s.ItemID = val
|
||||
}
|
||||
|
||||
// Why a lab failed: `lab_error` for an infrastructure failure, such as a node that did not boot or a
|
||||
// check that could not reach a node. It never depends on the candidate and is never a failed check.
|
||||
// Ref: #/components/schemas/AssessmentLabFailureReason
|
||||
type AssessmentLabFailureReason string
|
||||
|
||||
const (
|
||||
AssessmentLabFailureReasonLabError AssessmentLabFailureReason = "lab_error"
|
||||
)
|
||||
|
||||
// AllValues returns all AssessmentLabFailureReason values.
|
||||
func (AssessmentLabFailureReason) AllValues() []AssessmentLabFailureReason {
|
||||
return []AssessmentLabFailureReason{
|
||||
AssessmentLabFailureReasonLabError,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s AssessmentLabFailureReason) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case AssessmentLabFailureReasonLabError:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *AssessmentLabFailureReason) UnmarshalText(data []byte) error {
|
||||
switch AssessmentLabFailureReason(data) {
|
||||
case AssessmentLabFailureReasonLabError:
|
||||
*s = AssessmentLabFailureReasonLabError
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// AssessmentLabHeaders wraps AssessmentLab with response headers.
|
||||
type AssessmentLabHeaders struct {
|
||||
CacheControl CacheControlNoStore
|
||||
Response AssessmentLab
|
||||
}
|
||||
|
||||
// GetCacheControl returns the value of CacheControl.
|
||||
func (s *AssessmentLabHeaders) GetCacheControl() CacheControlNoStore {
|
||||
return s.CacheControl
|
||||
}
|
||||
|
||||
// GetResponse returns the value of Response.
|
||||
func (s *AssessmentLabHeaders) GetResponse() AssessmentLab {
|
||||
return s.Response
|
||||
}
|
||||
|
||||
// SetCacheControl sets the value of CacheControl.
|
||||
func (s *AssessmentLabHeaders) SetCacheControl(val CacheControlNoStore) {
|
||||
s.CacheControl = val
|
||||
}
|
||||
|
||||
// SetResponse sets the value of Response.
|
||||
func (s *AssessmentLabHeaders) SetResponse(val AssessmentLab) {
|
||||
s.Response = val
|
||||
}
|
||||
|
||||
func (*AssessmentLabHeaders) getMyAssessmentLabRes() {}
|
||||
func (*AssessmentLabHeaders) submitMyAssessmentLabRes() {}
|
||||
|
||||
// A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a
|
||||
// password, a key, or an infrastructure name.
|
||||
// Ref: #/components/schemas/AssessmentLabNode
|
||||
type AssessmentLabNode struct {
|
||||
Name AssessmentLabNodeName `json:"name"`
|
||||
Kind AssessmentLabNodeKind `json:"kind"`
|
||||
}
|
||||
|
||||
// GetName returns the value of Name.
|
||||
func (s *AssessmentLabNode) GetName() AssessmentLabNodeName {
|
||||
return s.Name
|
||||
}
|
||||
|
||||
// GetKind returns the value of Kind.
|
||||
func (s *AssessmentLabNode) GetKind() AssessmentLabNodeKind {
|
||||
return s.Kind
|
||||
}
|
||||
|
||||
// SetName sets the value of Name.
|
||||
func (s *AssessmentLabNode) SetName(val AssessmentLabNodeName) {
|
||||
s.Name = val
|
||||
}
|
||||
|
||||
// SetKind sets the value of Kind.
|
||||
func (s *AssessmentLabNode) SetKind(val AssessmentLabNodeKind) {
|
||||
s.Kind = val
|
||||
}
|
||||
|
||||
// What the console of a node shows.
|
||||
//
|
||||
// - mikrotik: a MikroTik router with the RouterOS console.
|
||||
// - ubuntu: a small Ubuntu server with a Linux login.
|
||||
//
|
||||
// Adding a value is a contract change.
|
||||
// Ref: #/components/schemas/AssessmentLabNodeKind
|
||||
type AssessmentLabNodeKind string
|
||||
|
||||
const (
|
||||
AssessmentLabNodeKindMikrotik AssessmentLabNodeKind = "mikrotik"
|
||||
AssessmentLabNodeKindUbuntu AssessmentLabNodeKind = "ubuntu"
|
||||
)
|
||||
|
||||
// AllValues returns all AssessmentLabNodeKind values.
|
||||
func (AssessmentLabNodeKind) AllValues() []AssessmentLabNodeKind {
|
||||
return []AssessmentLabNodeKind{
|
||||
AssessmentLabNodeKindMikrotik,
|
||||
AssessmentLabNodeKindUbuntu,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s AssessmentLabNodeKind) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case AssessmentLabNodeKindMikrotik:
|
||||
return []byte(s), nil
|
||||
case AssessmentLabNodeKindUbuntu:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *AssessmentLabNodeKind) UnmarshalText(data []byte) error {
|
||||
switch AssessmentLabNodeKind(data) {
|
||||
case AssessmentLabNodeKindMikrotik:
|
||||
*s = AssessmentLabNodeKindMikrotik
|
||||
return nil
|
||||
case AssessmentLabNodeKindUbuntu:
|
||||
*s = AssessmentLabNodeKindUbuntu
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
type AssessmentLabNodeName string
|
||||
|
||||
// State of a lab of an attempt item.
|
||||
//
|
||||
// - provisioning: the nodes are being prepared; poll GetMyAssessmentLab.
|
||||
// - ready: the consoles can be opened until `expires_at`.
|
||||
// - checking: the answer was accepted; the consoles are closed and the server checks the nodes.
|
||||
// - submitted: the check finished and the answer is recorded; the lab is deleted. The state never
|
||||
// says whether the answer was correct.
|
||||
// - expired: the lifetime or the attempt deadline ended before a submission; the lab is deleted and
|
||||
// the item cannot start another lab.
|
||||
// - failed: the lab infrastructure failed, independently of the candidate; `failure_reason` is
|
||||
// `lab_error`. Nothing was recorded or consumed, and the candidate may start a new lab of the same
|
||||
// item while the item is current.
|
||||
//
|
||||
// Adding a value is a contract change.
|
||||
// Ref: #/components/schemas/AssessmentLabState
|
||||
type AssessmentLabState string
|
||||
|
||||
const (
|
||||
AssessmentLabStateProvisioning AssessmentLabState = "provisioning"
|
||||
AssessmentLabStateReady AssessmentLabState = "ready"
|
||||
AssessmentLabStateChecking AssessmentLabState = "checking"
|
||||
AssessmentLabStateSubmitted AssessmentLabState = "submitted"
|
||||
AssessmentLabStateExpired AssessmentLabState = "expired"
|
||||
AssessmentLabStateFailed AssessmentLabState = "failed"
|
||||
)
|
||||
|
||||
// AllValues returns all AssessmentLabState values.
|
||||
func (AssessmentLabState) AllValues() []AssessmentLabState {
|
||||
return []AssessmentLabState{
|
||||
AssessmentLabStateProvisioning,
|
||||
AssessmentLabStateReady,
|
||||
AssessmentLabStateChecking,
|
||||
AssessmentLabStateSubmitted,
|
||||
AssessmentLabStateExpired,
|
||||
AssessmentLabStateFailed,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s AssessmentLabState) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case AssessmentLabStateProvisioning:
|
||||
return []byte(s), nil
|
||||
case AssessmentLabStateReady:
|
||||
return []byte(s), nil
|
||||
case AssessmentLabStateChecking:
|
||||
return []byte(s), nil
|
||||
case AssessmentLabStateSubmitted:
|
||||
return []byte(s), nil
|
||||
case AssessmentLabStateExpired:
|
||||
return []byte(s), nil
|
||||
case AssessmentLabStateFailed:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *AssessmentLabState) UnmarshalText(data []byte) error {
|
||||
switch AssessmentLabState(data) {
|
||||
case AssessmentLabStateProvisioning:
|
||||
*s = AssessmentLabStateProvisioning
|
||||
return nil
|
||||
case AssessmentLabStateReady:
|
||||
*s = AssessmentLabStateReady
|
||||
return nil
|
||||
case AssessmentLabStateChecking:
|
||||
*s = AssessmentLabStateChecking
|
||||
return nil
|
||||
case AssessmentLabStateSubmitted:
|
||||
*s = AssessmentLabStateSubmitted
|
||||
return nil
|
||||
case AssessmentLabStateExpired:
|
||||
*s = AssessmentLabStateExpired
|
||||
return nil
|
||||
case AssessmentLabStateFailed:
|
||||
*s = AssessmentLabStateFailed
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// Submit the lab of the current lab item as its answer. Unknown fields are rejected, so a request
|
||||
// cannot send a score or a correctness flag.
|
||||
// Ref: #/components/schemas/AssessmentLabSubmission
|
||||
type AssessmentLabSubmission struct {
|
||||
ExpectedVersion AssessmentAttemptVersion `json:"expected_version"`
|
||||
Answer LabAnswer `json:"answer"`
|
||||
}
|
||||
|
||||
// GetExpectedVersion returns the value of ExpectedVersion.
|
||||
func (s *AssessmentLabSubmission) GetExpectedVersion() AssessmentAttemptVersion {
|
||||
return s.ExpectedVersion
|
||||
}
|
||||
|
||||
// GetAnswer returns the value of Answer.
|
||||
func (s *AssessmentLabSubmission) GetAnswer() LabAnswer {
|
||||
return s.Answer
|
||||
}
|
||||
|
||||
// SetExpectedVersion sets the value of ExpectedVersion.
|
||||
func (s *AssessmentLabSubmission) SetExpectedVersion(val AssessmentAttemptVersion) {
|
||||
s.ExpectedVersion = val
|
||||
}
|
||||
|
||||
// SetAnswer sets the value of Answer.
|
||||
func (s *AssessmentLabSubmission) SetAnswer(val LabAnswer) {
|
||||
s.Answer = val
|
||||
}
|
||||
|
||||
// Known limitation of the method behind a real-assessment result, shown with the result.
|
||||
//
|
||||
// - uncalibrated_thresholds: the thresholds are not yet validated on a pilot.
|
||||
@@ -9746,6 +10228,58 @@ type CreateMyAssessmentAttemptUnprocessableEntity Problem
|
||||
|
||||
func (*CreateMyAssessmentAttemptUnprocessableEntity) createMyAssessmentAttemptRes() {}
|
||||
|
||||
type CreateMyAssessmentLabBadRequest Problem
|
||||
|
||||
func (*CreateMyAssessmentLabBadRequest) createMyAssessmentLabRes() {}
|
||||
|
||||
type CreateMyAssessmentLabConflict Problem
|
||||
|
||||
func (*CreateMyAssessmentLabConflict) createMyAssessmentLabRes() {}
|
||||
|
||||
type CreateMyAssessmentLabConsoleSessionBadRequest Problem
|
||||
|
||||
func (*CreateMyAssessmentLabConsoleSessionBadRequest) createMyAssessmentLabConsoleSessionRes() {}
|
||||
|
||||
type CreateMyAssessmentLabConsoleSessionConflict Problem
|
||||
|
||||
func (*CreateMyAssessmentLabConsoleSessionConflict) createMyAssessmentLabConsoleSessionRes() {}
|
||||
|
||||
type CreateMyAssessmentLabConsoleSessionForbidden Problem
|
||||
|
||||
func (*CreateMyAssessmentLabConsoleSessionForbidden) createMyAssessmentLabConsoleSessionRes() {}
|
||||
|
||||
type CreateMyAssessmentLabConsoleSessionNotFound Problem
|
||||
|
||||
func (*CreateMyAssessmentLabConsoleSessionNotFound) createMyAssessmentLabConsoleSessionRes() {}
|
||||
|
||||
type CreateMyAssessmentLabConsoleSessionUnauthorized Problem
|
||||
|
||||
func (*CreateMyAssessmentLabConsoleSessionUnauthorized) createMyAssessmentLabConsoleSessionRes() {}
|
||||
|
||||
type CreateMyAssessmentLabCreated AssessmentLabHeaders
|
||||
|
||||
func (*CreateMyAssessmentLabCreated) createMyAssessmentLabRes() {}
|
||||
|
||||
type CreateMyAssessmentLabForbidden Problem
|
||||
|
||||
func (*CreateMyAssessmentLabForbidden) createMyAssessmentLabRes() {}
|
||||
|
||||
type CreateMyAssessmentLabNotFound Problem
|
||||
|
||||
func (*CreateMyAssessmentLabNotFound) createMyAssessmentLabRes() {}
|
||||
|
||||
type CreateMyAssessmentLabOK AssessmentLabHeaders
|
||||
|
||||
func (*CreateMyAssessmentLabOK) createMyAssessmentLabRes() {}
|
||||
|
||||
type CreateMyAssessmentLabUnauthorized Problem
|
||||
|
||||
func (*CreateMyAssessmentLabUnauthorized) createMyAssessmentLabRes() {}
|
||||
|
||||
type CreateMyAssessmentLabUnprocessableEntity Problem
|
||||
|
||||
func (*CreateMyAssessmentLabUnprocessableEntity) createMyAssessmentLabRes() {}
|
||||
|
||||
type CreateMyAssessmentPracticeRunBadRequest Problem
|
||||
|
||||
func (*CreateMyAssessmentPracticeRunBadRequest) createMyAssessmentPracticeRunRes() {}
|
||||
@@ -11015,6 +11549,18 @@ type GetMyAssessmentAvailabilityUnauthorized Problem
|
||||
|
||||
func (*GetMyAssessmentAvailabilityUnauthorized) getMyAssessmentAvailabilityRes() {}
|
||||
|
||||
type GetMyAssessmentLabForbidden Problem
|
||||
|
||||
func (*GetMyAssessmentLabForbidden) getMyAssessmentLabRes() {}
|
||||
|
||||
type GetMyAssessmentLabNotFound Problem
|
||||
|
||||
func (*GetMyAssessmentLabNotFound) getMyAssessmentLabRes() {}
|
||||
|
||||
type GetMyAssessmentLabUnauthorized Problem
|
||||
|
||||
func (*GetMyAssessmentLabUnauthorized) getMyAssessmentLabRes() {}
|
||||
|
||||
type GetMyAssessmentPracticeRunForbidden Problem
|
||||
|
||||
func (*GetMyAssessmentPracticeRunForbidden) getMyAssessmentPracticeRunRes() {}
|
||||
@@ -12862,6 +13408,7 @@ type ItemContent struct {
|
||||
FindErrorItemContent FindErrorItemContent
|
||||
ConfigurationItemContent ConfigurationItemContent
|
||||
PracticeItemContent PracticeItemContent
|
||||
LabItemContent LabItemContent
|
||||
}
|
||||
|
||||
// ItemContentType is oneOf type of ItemContent.
|
||||
@@ -12876,6 +13423,7 @@ const (
|
||||
FindErrorItemContentItemContent ItemContentType = "FindErrorItemContent"
|
||||
ConfigurationItemContentItemContent ItemContentType = "ConfigurationItemContent"
|
||||
PracticeItemContentItemContent ItemContentType = "PracticeItemContent"
|
||||
LabItemContentItemContent ItemContentType = "LabItemContent"
|
||||
)
|
||||
|
||||
// IsChoiceItemContent reports whether ItemContent is ChoiceItemContent.
|
||||
@@ -12901,6 +13449,9 @@ func (s ItemContent) IsConfigurationItemContent() bool {
|
||||
// IsPracticeItemContent reports whether ItemContent is PracticeItemContent.
|
||||
func (s ItemContent) IsPracticeItemContent() bool { return s.Type == PracticeItemContentItemContent }
|
||||
|
||||
// IsLabItemContent reports whether ItemContent is LabItemContent.
|
||||
func (s ItemContent) IsLabItemContent() bool { return s.Type == LabItemContentItemContent }
|
||||
|
||||
// SetChoiceItemContent sets ItemContent to ChoiceItemContent.
|
||||
func (s *ItemContent) SetChoiceItemContent(v ChoiceItemContent) {
|
||||
s.Type = ChoiceItemContentItemContent
|
||||
@@ -13048,6 +13599,172 @@ func NewPracticeItemContentItemContent(v PracticeItemContent) ItemContent {
|
||||
return s
|
||||
}
|
||||
|
||||
// SetLabItemContent sets ItemContent to LabItemContent.
|
||||
func (s *ItemContent) SetLabItemContent(v LabItemContent) {
|
||||
s.Type = LabItemContentItemContent
|
||||
s.LabItemContent = v
|
||||
}
|
||||
|
||||
// GetLabItemContent returns LabItemContent and true boolean if ItemContent is LabItemContent.
|
||||
func (s ItemContent) GetLabItemContent() (v LabItemContent, ok bool) {
|
||||
if !s.IsLabItemContent() {
|
||||
return v, false
|
||||
}
|
||||
return s.LabItemContent, true
|
||||
}
|
||||
|
||||
// NewLabItemContentItemContent returns new ItemContent from LabItemContent.
|
||||
func NewLabItemContentItemContent(v LabItemContent) ItemContent {
|
||||
var s ItemContent
|
||||
s.SetLabItemContent(v)
|
||||
return s
|
||||
}
|
||||
|
||||
// Answer of a lab item: the state of the nodes of the named lab at the moment of submission. The
|
||||
// server reads that state with the checker of the task; the body carries no configuration text, score,
|
||||
// or correctness flag. Two answers are equal when they name the same lab. It is the answer of
|
||||
// SubmitMyAssessmentLab only and is not a member of AssessmentAnswer.
|
||||
// Ref: #/components/schemas/LabAnswer
|
||||
type LabAnswer struct {
|
||||
Format LabAnswerFormat `json:"format"`
|
||||
// The lab of this item that the candidate worked in.
|
||||
LabID uuid.UUID `json:"lab_id"`
|
||||
}
|
||||
|
||||
// GetFormat returns the value of Format.
|
||||
func (s *LabAnswer) GetFormat() LabAnswerFormat {
|
||||
return s.Format
|
||||
}
|
||||
|
||||
// GetLabID returns the value of LabID.
|
||||
func (s *LabAnswer) GetLabID() uuid.UUID {
|
||||
return s.LabID
|
||||
}
|
||||
|
||||
// SetFormat sets the value of Format.
|
||||
func (s *LabAnswer) SetFormat(val LabAnswerFormat) {
|
||||
s.Format = val
|
||||
}
|
||||
|
||||
// SetLabID sets the value of LabID.
|
||||
func (s *LabAnswer) SetLabID(val uuid.UUID) {
|
||||
s.LabID = val
|
||||
}
|
||||
|
||||
type LabAnswerFormat string
|
||||
|
||||
const (
|
||||
LabAnswerFormatLab LabAnswerFormat = "lab"
|
||||
)
|
||||
|
||||
// AllValues returns all LabAnswerFormat values.
|
||||
func (LabAnswerFormat) AllValues() []LabAnswerFormat {
|
||||
return []LabAnswerFormat{
|
||||
LabAnswerFormatLab,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s LabAnswerFormat) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case LabAnswerFormatLab:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *LabAnswerFormat) UnmarshalText(data []byte) error {
|
||||
switch LabAnswerFormat(data) {
|
||||
case LabAnswerFormatLab:
|
||||
*s = LabAnswerFormatLab
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// Practical lab: configure or repair a small network of virtual nodes through their consoles. The
|
||||
// candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and
|
||||
// submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists
|
||||
// only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the
|
||||
// seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted
|
||||
// only with SubmitMyAssessmentLab.
|
||||
// Ref: #/components/schemas/LabItemContent
|
||||
type LabItemContent struct {
|
||||
Format LabItemContentFormat `json:"format"`
|
||||
// Nodes of the lab in the order of the statement.
|
||||
Nodes []AssessmentLabNode `json:"nodes"`
|
||||
// Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt
|
||||
// deadline.
|
||||
TimeLimitSeconds int32 `json:"time_limit_seconds"`
|
||||
}
|
||||
|
||||
// GetFormat returns the value of Format.
|
||||
func (s *LabItemContent) GetFormat() LabItemContentFormat {
|
||||
return s.Format
|
||||
}
|
||||
|
||||
// GetNodes returns the value of Nodes.
|
||||
func (s *LabItemContent) GetNodes() []AssessmentLabNode {
|
||||
return s.Nodes
|
||||
}
|
||||
|
||||
// GetTimeLimitSeconds returns the value of TimeLimitSeconds.
|
||||
func (s *LabItemContent) GetTimeLimitSeconds() int32 {
|
||||
return s.TimeLimitSeconds
|
||||
}
|
||||
|
||||
// SetFormat sets the value of Format.
|
||||
func (s *LabItemContent) SetFormat(val LabItemContentFormat) {
|
||||
s.Format = val
|
||||
}
|
||||
|
||||
// SetNodes sets the value of Nodes.
|
||||
func (s *LabItemContent) SetNodes(val []AssessmentLabNode) {
|
||||
s.Nodes = val
|
||||
}
|
||||
|
||||
// SetTimeLimitSeconds sets the value of TimeLimitSeconds.
|
||||
func (s *LabItemContent) SetTimeLimitSeconds(val int32) {
|
||||
s.TimeLimitSeconds = val
|
||||
}
|
||||
|
||||
type LabItemContentFormat string
|
||||
|
||||
const (
|
||||
LabItemContentFormatLab LabItemContentFormat = "lab"
|
||||
)
|
||||
|
||||
// AllValues returns all LabItemContentFormat values.
|
||||
func (LabItemContentFormat) AllValues() []LabItemContentFormat {
|
||||
return []LabItemContentFormat{
|
||||
LabItemContentFormatLab,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s LabItemContentFormat) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case LabItemContentFormatLab:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *LabItemContentFormat) UnmarshalText(data []byte) error {
|
||||
switch LabItemContentFormat(data) {
|
||||
case LabItemContentFormatLab:
|
||||
*s = LabItemContentFormatLab
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
type ListMyAssessmentResultsBadRequest Problem
|
||||
|
||||
func (*ListMyAssessmentResultsBadRequest) listMyAssessmentResultsRes() {}
|
||||
@@ -17873,6 +18590,51 @@ func (o NilAssessmentItem) Or(d AssessmentItem) AssessmentItem {
|
||||
return d
|
||||
}
|
||||
|
||||
// NewNilAssessmentLabFailureReason returns new NilAssessmentLabFailureReason with value set to v.
|
||||
func NewNilAssessmentLabFailureReason(v AssessmentLabFailureReason) NilAssessmentLabFailureReason {
|
||||
return NilAssessmentLabFailureReason{
|
||||
Value: v,
|
||||
}
|
||||
}
|
||||
|
||||
// NilAssessmentLabFailureReason is nullable AssessmentLabFailureReason.
|
||||
type NilAssessmentLabFailureReason struct {
|
||||
Value AssessmentLabFailureReason
|
||||
Null bool
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *NilAssessmentLabFailureReason) SetTo(v AssessmentLabFailureReason) {
|
||||
o.Null = false
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// IsNull returns true if value is Null.
|
||||
func (o NilAssessmentLabFailureReason) IsNull() bool { return o.Null }
|
||||
|
||||
// SetToNull sets value to null.
|
||||
func (o *NilAssessmentLabFailureReason) SetToNull() {
|
||||
o.Null = true
|
||||
var v AssessmentLabFailureReason
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// Get returns value and boolean that denotes whether value was set.
|
||||
func (o NilAssessmentLabFailureReason) Get() (v AssessmentLabFailureReason, ok bool) {
|
||||
if o.Null {
|
||||
return v, false
|
||||
}
|
||||
return o.Value, true
|
||||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o NilAssessmentLabFailureReason) Or(d AssessmentLabFailureReason) AssessmentLabFailureReason {
|
||||
if v, ok := o.Get(); ok {
|
||||
return v
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// NewNilAssessmentNotDeterminedReason returns new NilAssessmentNotDeterminedReason with value set to v.
|
||||
func NewNilAssessmentNotDeterminedReason(v AssessmentNotDeterminedReason) NilAssessmentNotDeterminedReason {
|
||||
return NilAssessmentNotDeterminedReason{
|
||||
@@ -30237,7 +30999,10 @@ func (s *ServiceUnavailableHeaders) SetResponse(val Problem) {
|
||||
s.Response = val
|
||||
}
|
||||
|
||||
func (*ServiceUnavailableHeaders) createMyAssessmentPracticeRunRes() {}
|
||||
func (*ServiceUnavailableHeaders) createMyAssessmentLabConsoleSessionRes() {}
|
||||
func (*ServiceUnavailableHeaders) createMyAssessmentLabRes() {}
|
||||
func (*ServiceUnavailableHeaders) createMyAssessmentPracticeRunRes() {}
|
||||
func (*ServiceUnavailableHeaders) submitMyAssessmentLabRes() {}
|
||||
|
||||
// Current session as the client may see it: the account and the CSRF token. The session identifier
|
||||
// itself travels only in the HttpOnly session cookie and never appears in a body.
|
||||
@@ -30717,6 +31482,34 @@ type SubmitMyAssessmentAnswerUnprocessableEntity Problem
|
||||
|
||||
func (*SubmitMyAssessmentAnswerUnprocessableEntity) submitMyAssessmentAnswerRes() {}
|
||||
|
||||
type SubmitMyAssessmentLabBadRequest Problem
|
||||
|
||||
func (*SubmitMyAssessmentLabBadRequest) submitMyAssessmentLabRes() {}
|
||||
|
||||
type SubmitMyAssessmentLabConflict Problem
|
||||
|
||||
func (*SubmitMyAssessmentLabConflict) submitMyAssessmentLabRes() {}
|
||||
|
||||
type SubmitMyAssessmentLabForbidden Problem
|
||||
|
||||
func (*SubmitMyAssessmentLabForbidden) submitMyAssessmentLabRes() {}
|
||||
|
||||
type SubmitMyAssessmentLabNotFound Problem
|
||||
|
||||
func (*SubmitMyAssessmentLabNotFound) submitMyAssessmentLabRes() {}
|
||||
|
||||
type SubmitMyAssessmentLabPreconditionFailed Problem
|
||||
|
||||
func (*SubmitMyAssessmentLabPreconditionFailed) submitMyAssessmentLabRes() {}
|
||||
|
||||
type SubmitMyAssessmentLabUnauthorized Problem
|
||||
|
||||
func (*SubmitMyAssessmentLabUnauthorized) submitMyAssessmentLabRes() {}
|
||||
|
||||
type SubmitMyAssessmentLabUnprocessableEntity Problem
|
||||
|
||||
func (*SubmitMyAssessmentLabUnprocessableEntity) submitMyAssessmentLabRes() {}
|
||||
|
||||
// Case of the current account. It contains what the author sent, the public processing state, and the
|
||||
// public history. It never contains the identity of a moderator, an expert, or a support agent,
|
||||
// internal notes, evidence, assessment answers or anti-cheat signals, risk signals, or contact data of
|
||||
@@ -32837,36 +33630,39 @@ func (s *TooManyRequestsHeaders) SetResponse(val Problem) {
|
||||
s.Response = val
|
||||
}
|
||||
|
||||
func (*TooManyRequestsHeaders) acceptMyInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) cancelMyInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) confirmEmailByCodeRes() {}
|
||||
func (*TooManyRequestsHeaders) confirmEmailRes() {}
|
||||
func (*TooManyRequestsHeaders) createMyAssessmentAttemptRes() {}
|
||||
func (*TooManyRequestsHeaders) createMyAssessmentPracticeRunRes() {}
|
||||
func (*TooManyRequestsHeaders) createMySupportCaseRes() {}
|
||||
func (*TooManyRequestsHeaders) createOrganizationInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) createOrganizationNeedRes() {}
|
||||
func (*TooManyRequestsHeaders) createOrganizationRes() {}
|
||||
func (*TooManyRequestsHeaders) declineMyInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) getOrganizationCandidateCardRes() {}
|
||||
func (*TooManyRequestsHeaders) getOrganizationCandidateEvidenceRes() {}
|
||||
func (*TooManyRequestsHeaders) hideOrganizationRes() {}
|
||||
func (*TooManyRequestsHeaders) loginRes() {}
|
||||
func (*TooManyRequestsHeaders) markMyNotificationReadRes() {}
|
||||
func (*TooManyRequestsHeaders) markOrganizationNotificationReadRes() {}
|
||||
func (*TooManyRequestsHeaders) raiseOrganizationInvitationSalaryRes() {}
|
||||
func (*TooManyRequestsHeaders) recordMyAssessmentAttemptSignalsRes() {}
|
||||
func (*TooManyRequestsHeaders) registerAccountRes() {}
|
||||
func (*TooManyRequestsHeaders) requestMyRepositoryChecksRes() {}
|
||||
func (*TooManyRequestsHeaders) resendEmailVerificationRes() {}
|
||||
func (*TooManyRequestsHeaders) sendOrganizationInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) startMyAssessmentAttemptSessionRes() {}
|
||||
func (*TooManyRequestsHeaders) submitMyAssessmentAnswerRes() {}
|
||||
func (*TooManyRequestsHeaders) updateOrganizationInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) updateOrganizationNeedRes() {}
|
||||
func (*TooManyRequestsHeaders) updateOrganizationRes() {}
|
||||
func (*TooManyRequestsHeaders) viewMyInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) withdrawOrganizationInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) acceptMyInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) cancelMyInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) confirmEmailByCodeRes() {}
|
||||
func (*TooManyRequestsHeaders) confirmEmailRes() {}
|
||||
func (*TooManyRequestsHeaders) createMyAssessmentAttemptRes() {}
|
||||
func (*TooManyRequestsHeaders) createMyAssessmentLabConsoleSessionRes() {}
|
||||
func (*TooManyRequestsHeaders) createMyAssessmentLabRes() {}
|
||||
func (*TooManyRequestsHeaders) createMyAssessmentPracticeRunRes() {}
|
||||
func (*TooManyRequestsHeaders) createMySupportCaseRes() {}
|
||||
func (*TooManyRequestsHeaders) createOrganizationInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) createOrganizationNeedRes() {}
|
||||
func (*TooManyRequestsHeaders) createOrganizationRes() {}
|
||||
func (*TooManyRequestsHeaders) declineMyInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) getOrganizationCandidateCardRes() {}
|
||||
func (*TooManyRequestsHeaders) getOrganizationCandidateEvidenceRes() {}
|
||||
func (*TooManyRequestsHeaders) hideOrganizationRes() {}
|
||||
func (*TooManyRequestsHeaders) loginRes() {}
|
||||
func (*TooManyRequestsHeaders) markMyNotificationReadRes() {}
|
||||
func (*TooManyRequestsHeaders) markOrganizationNotificationReadRes() {}
|
||||
func (*TooManyRequestsHeaders) raiseOrganizationInvitationSalaryRes() {}
|
||||
func (*TooManyRequestsHeaders) recordMyAssessmentAttemptSignalsRes() {}
|
||||
func (*TooManyRequestsHeaders) registerAccountRes() {}
|
||||
func (*TooManyRequestsHeaders) requestMyRepositoryChecksRes() {}
|
||||
func (*TooManyRequestsHeaders) resendEmailVerificationRes() {}
|
||||
func (*TooManyRequestsHeaders) sendOrganizationInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) startMyAssessmentAttemptSessionRes() {}
|
||||
func (*TooManyRequestsHeaders) submitMyAssessmentAnswerRes() {}
|
||||
func (*TooManyRequestsHeaders) submitMyAssessmentLabRes() {}
|
||||
func (*TooManyRequestsHeaders) updateOrganizationInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) updateOrganizationNeedRes() {}
|
||||
func (*TooManyRequestsHeaders) updateOrganizationRes() {}
|
||||
func (*TooManyRequestsHeaders) viewMyInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) withdrawOrganizationInvitationRes() {}
|
||||
|
||||
type UnhideOrganizationBadRequest Problem
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
AcknowledgeMyAssessmentSignalNoticeOperation: []string{},
|
||||
CancelMyInvitationOperation: []string{},
|
||||
CreateMyAssessmentAttemptOperation: []string{},
|
||||
CreateMyAssessmentLabOperation: []string{},
|
||||
CreateMyAssessmentLabConsoleSessionOperation: []string{},
|
||||
CreateMyAssessmentPracticeRunOperation: []string{},
|
||||
CreateMySupportCaseOperation: []string{},
|
||||
CreateOrganizationOperation: []string{},
|
||||
@@ -71,6 +73,7 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
GetCurrentSessionOperation: []string{},
|
||||
GetMyAssessmentAttemptOperation: []string{},
|
||||
GetMyAssessmentAvailabilityOperation: []string{},
|
||||
GetMyAssessmentLabOperation: []string{},
|
||||
GetMyAssessmentPracticeRunOperation: []string{},
|
||||
GetMyAssessmentResultOperation: []string{},
|
||||
GetMyAssessmentSignalNoticeOperation: []string{},
|
||||
@@ -121,6 +124,7 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
SetMySearchStatusOperation: []string{},
|
||||
StartMyAssessmentAttemptSessionOperation: []string{},
|
||||
SubmitMyAssessmentAnswerOperation: []string{},
|
||||
SubmitMyAssessmentLabOperation: []string{},
|
||||
UnhideOrganizationOperation: []string{},
|
||||
UpdateOrganizationOperation: []string{},
|
||||
UpdateOrganizationInvitationOperation: []string{},
|
||||
@@ -156,6 +160,8 @@ var operationRolesSessionCsrf = map[string][]string{
|
||||
AcknowledgeMyAssessmentSignalNoticeOperation: []string{},
|
||||
CancelMyInvitationOperation: []string{},
|
||||
CreateMyAssessmentAttemptOperation: []string{},
|
||||
CreateMyAssessmentLabOperation: []string{},
|
||||
CreateMyAssessmentLabConsoleSessionOperation: []string{},
|
||||
CreateMyAssessmentPracticeRunOperation: []string{},
|
||||
CreateMySupportCaseOperation: []string{},
|
||||
CreateOrganizationOperation: []string{},
|
||||
@@ -184,6 +190,7 @@ var operationRolesSessionCsrf = map[string][]string{
|
||||
SetMySearchStatusOperation: []string{},
|
||||
StartMyAssessmentAttemptSessionOperation: []string{},
|
||||
SubmitMyAssessmentAnswerOperation: []string{},
|
||||
SubmitMyAssessmentLabOperation: []string{},
|
||||
UnhideOrganizationOperation: []string{},
|
||||
UpdateOrganizationOperation: []string{},
|
||||
UpdateOrganizationInvitationOperation: []string{},
|
||||
|
||||
@@ -230,6 +230,67 @@ type Handler interface {
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts
|
||||
CreateMyAssessmentAttempt(ctx context.Context, req AssessmentAttemptCreate, params CreateMyAssessmentAttemptParams) (CreateMyAssessmentAttemptRes, error)
|
||||
// CreateMyAssessmentLab implements CreateMyAssessmentLab operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// an allowed Origin, and an Idempotency-Key. The body names the current item, whose content has the
|
||||
// format `lab`.
|
||||
//
|
||||
// The server asks the lab provisioner for a lab of the variant fixed for this item instance and
|
||||
// answers 201 with the lab `provisioning`; the client polls GetMyAssessmentLab until it is `ready`.
|
||||
// The lab lives until `expires_at`, the earlier of the item's `time_limit_seconds` and the attempt
|
||||
// deadline, and is then deleted with everything done in it. Creating a lab does not change the attempt
|
||||
// version, the current item, or any answer.
|
||||
//
|
||||
// One lab per item at a time. While the item has a lab in `provisioning`, `ready`, or `checking`, the
|
||||
// server answers 200 with that lab and starts no second one. After a `failed` lab the candidate may
|
||||
// start a new one while the item is current; after `submitted` or `expired` the item cannot start
|
||||
// another lab (409 state_conflict).
|
||||
//
|
||||
// Busy pool. When the lab pool of the provisioner has no free capacity, the server answers 503
|
||||
// service_unavailable with Retry-After, for example
|
||||
// `{"type": "urn:lincodex:problem:service_unavailable", "title": "Service unavailable", "status": 503, "code": "service_unavailable", "detail": "No lab capacity is free. The attempt is unchanged; retry later."}`.
|
||||
// Nothing was stored: no lab exists, the attempt version and the current item are unchanged, the lab
|
||||
// lifetime has not started, and the attempt is not consumed; the client retries after Retry-After with
|
||||
// a new Idempotency-Key. When labs are not enabled on this server, or the provisioner cannot be
|
||||
// reached, the server answers 503 service_unavailable without Retry-After and stores nothing either.
|
||||
// The attempt deadline keeps running in both cases.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay),
|
||||
// the attempt and the item (404 not_found for an unknown attempt or item, or one of another
|
||||
// candidate), the state (409 state_conflict: the attempt is terminal or its work session ended, the
|
||||
// item is not current, its format is not `lab`, or its lab was submitted or expired), the rate limit
|
||||
// (429), then the availability of labs and the capacity (503). Following the Idempotency-Key
|
||||
// convention, 201, 200, 404, and 409 state_conflict are stored under the key and replayed; 400, 429,
|
||||
// and 503 are not.
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts/{attempt_id}/labs
|
||||
CreateMyAssessmentLab(ctx context.Context, req *AssessmentLabCreate, params CreateMyAssessmentLabParams) (CreateMyAssessmentLabRes, error)
|
||||
// CreateMyAssessmentLabConsoleSession implements CreateMyAssessmentLabConsoleSession operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. The body names a node of the lab by its task name.
|
||||
//
|
||||
// The response describes one console session: the client opens a WebSocket to `websocket_path` on the
|
||||
// same origin before `expires_at`. The upgrade is authorized by the session cookie and the Origin
|
||||
// check, and the server relays the serial console of the node through the lab provisioner. The
|
||||
// response never carries a node address, a port, a password, a key, or a token; the browser never
|
||||
// connects to a node or to the provisioner. Console traffic is not stored as an answer and is not
|
||||
// logged.
|
||||
//
|
||||
// The WebSocket relay is planned together with the candidate interface of labs; this contract fixes
|
||||
// the session shape it uses.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden), the attempt and the lab (404 not_found for an unknown attempt,
|
||||
// lab, or one of another candidate), the node (400 with the pointer `/node`), the state (409
|
||||
// state_conflict: the lab is not `ready`, the attempt is terminal, or its work session ended), the
|
||||
// limit of open sessions per lab (429 rate_limited with Retry-After), then the provisioner (503
|
||||
// service_unavailable without Retry-After; nothing was opened).
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts/{attempt_id}/labs/{lab_id}/console-sessions
|
||||
CreateMyAssessmentLabConsoleSession(ctx context.Context, req *AssessmentLabConsoleSessionCreate, params CreateMyAssessmentLabConsoleSessionParams) (CreateMyAssessmentLabConsoleSessionRes, error)
|
||||
// CreateMyAssessmentPracticeRun implements CreateMyAssessmentPracticeRun operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
@@ -663,6 +724,19 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/me/assessment-availability
|
||||
GetMyAssessmentAvailability(ctx context.Context) (GetMyAssessmentAvailabilityRes, error)
|
||||
// GetMyAssessmentLab implements GetMyAssessmentLab operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. Returns the state of a lab started with
|
||||
// CreateMyAssessmentLab: whether it is still provisioning, ready for the consoles, being checked after
|
||||
// the submission, or ended. It never contains a node address, a credential, the seed, the checker
|
||||
// state, or the result of the check. This GET is read-only; the server may record a due timer
|
||||
// transition, such as `ready` to `expired`, before it answers.
|
||||
//
|
||||
// A lab of another candidate's attempt, a lab of another attempt, and an unknown identifier all answer
|
||||
// 404 not_found.
|
||||
//
|
||||
// GET /api/v1/me/assessment-attempts/{attempt_id}/labs/{lab_id}
|
||||
GetMyAssessmentLab(ctx context.Context, params GetMyAssessmentLabParams) (GetMyAssessmentLabRes, error)
|
||||
// GetMyAssessmentPracticeRun implements GetMyAssessmentPracticeRun operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. Returns the state of a debug run started with
|
||||
@@ -2031,6 +2105,10 @@ type Handler interface {
|
||||
// times itself and scores the answer with the key of the fixed item instance. Time never enters the
|
||||
// ability estimate or the grade decision.
|
||||
//
|
||||
// Lab: an item with format `lab` takes no answer here. Its lab is started with CreateMyAssessmentLab
|
||||
// and submitted with SubmitMyAssessmentLab; any answer to a lab item answers 400 validation_failed
|
||||
// with the pointer `/answer/format`, like an answer in the wrong format, and stores nothing.
|
||||
//
|
||||
// The response is the attempt with the next item to answer. It never says whether the answer was
|
||||
// correct. Items are answered in order and each answer is final.
|
||||
//
|
||||
@@ -2089,6 +2167,37 @@ type Handler interface {
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts/{attempt_id}/answers
|
||||
SubmitMyAssessmentAnswer(ctx context.Context, req *AssessmentAnswerSubmission, params SubmitMyAssessmentAnswerParams) (SubmitMyAssessmentAnswerRes, error)
|
||||
// SubmitMyAssessmentLab implements SubmitMyAssessmentLab operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// an allowed Origin, and an Idempotency-Key. The body carries the attempt version last read and the
|
||||
// answer with format `lab`, which names the lab.
|
||||
//
|
||||
// The server closes the consoles, freezes the lab, and answers 202 with the lab `checking`; the
|
||||
// checker of the task reads the state of the nodes asynchronously, the answer is recorded, and the lab
|
||||
// becomes `submitted` and is deleted. The client polls GetMyAssessmentLab and then reads the attempt,
|
||||
// which moves to the next item. Neither response says whether the answer was correct, and the
|
||||
// candidate never sees the checker criteria or their results.
|
||||
//
|
||||
// When the checker cannot reach the nodes because of the lab infrastructure, the lab becomes `failed`
|
||||
// with `lab_error`: nothing is recorded or consumed, the attempt version is unchanged, and the
|
||||
// candidate may start a new lab of the item while it is current. A failure of the infrastructure is
|
||||
// never scored as a wrong answer.
|
||||
//
|
||||
// Optimistic concurrency: `expected_version` must equal the current attempt version, otherwise the
|
||||
// server answers 412 version_conflict and stores nothing.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay),
|
||||
// the attempt and the lab (404 not_found for an unknown attempt or lab, or one of another candidate),
|
||||
// the version (412), the state (409 state_conflict: the lab is not `ready`, `answer.lab_id` is not the
|
||||
// lab in the path, the item is not current, the attempt is terminal, or its work session ended), then
|
||||
// the provisioner (503 service_unavailable without Retry-After; nothing was stored and the lab keeps
|
||||
// running). Following the Idempotency-Key convention, 202, 404, and 409 state_conflict are stored
|
||||
// under the key and replayed; 400, 412, 429, and 5xx are not.
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts/{attempt_id}/labs/{lab_id}/submission
|
||||
SubmitMyAssessmentLab(ctx context.Context, req *AssessmentLabSubmission, params SubmitMyAssessmentLabParams) (SubmitMyAssessmentLabRes, error)
|
||||
// UnhideOrganization implements UnhideOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
|
||||
@@ -253,6 +253,73 @@ func (UnimplementedHandler) CreateMyAssessmentAttempt(ctx context.Context, req A
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// CreateMyAssessmentLab implements CreateMyAssessmentLab operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// an allowed Origin, and an Idempotency-Key. The body names the current item, whose content has the
|
||||
// format `lab`.
|
||||
//
|
||||
// The server asks the lab provisioner for a lab of the variant fixed for this item instance and
|
||||
// answers 201 with the lab `provisioning`; the client polls GetMyAssessmentLab until it is `ready`.
|
||||
// The lab lives until `expires_at`, the earlier of the item's `time_limit_seconds` and the attempt
|
||||
// deadline, and is then deleted with everything done in it. Creating a lab does not change the attempt
|
||||
// version, the current item, or any answer.
|
||||
//
|
||||
// One lab per item at a time. While the item has a lab in `provisioning`, `ready`, or `checking`, the
|
||||
// server answers 200 with that lab and starts no second one. After a `failed` lab the candidate may
|
||||
// start a new one while the item is current; after `submitted` or `expired` the item cannot start
|
||||
// another lab (409 state_conflict).
|
||||
//
|
||||
// Busy pool. When the lab pool of the provisioner has no free capacity, the server answers 503
|
||||
// service_unavailable with Retry-After, for example
|
||||
// `{"type": "urn:lincodex:problem:service_unavailable", "title": "Service unavailable", "status": 503, "code": "service_unavailable", "detail": "No lab capacity is free. The attempt is unchanged; retry later."}`.
|
||||
// Nothing was stored: no lab exists, the attempt version and the current item are unchanged, the lab
|
||||
// lifetime has not started, and the attempt is not consumed; the client retries after Retry-After with
|
||||
// a new Idempotency-Key. When labs are not enabled on this server, or the provisioner cannot be
|
||||
// reached, the server answers 503 service_unavailable without Retry-After and stores nothing either.
|
||||
// The attempt deadline keeps running in both cases.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay),
|
||||
// the attempt and the item (404 not_found for an unknown attempt or item, or one of another
|
||||
// candidate), the state (409 state_conflict: the attempt is terminal or its work session ended, the
|
||||
// item is not current, its format is not `lab`, or its lab was submitted or expired), the rate limit
|
||||
// (429), then the availability of labs and the capacity (503). Following the Idempotency-Key
|
||||
// convention, 201, 200, 404, and 409 state_conflict are stored under the key and replayed; 400, 429,
|
||||
// and 503 are not.
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts/{attempt_id}/labs
|
||||
func (UnimplementedHandler) CreateMyAssessmentLab(ctx context.Context, req *AssessmentLabCreate, params CreateMyAssessmentLabParams) (r CreateMyAssessmentLabRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// CreateMyAssessmentLabConsoleSession implements CreateMyAssessmentLabConsoleSession operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. The body names a node of the lab by its task name.
|
||||
//
|
||||
// The response describes one console session: the client opens a WebSocket to `websocket_path` on the
|
||||
// same origin before `expires_at`. The upgrade is authorized by the session cookie and the Origin
|
||||
// check, and the server relays the serial console of the node through the lab provisioner. The
|
||||
// response never carries a node address, a port, a password, a key, or a token; the browser never
|
||||
// connects to a node or to the provisioner. Console traffic is not stored as an answer and is not
|
||||
// logged.
|
||||
//
|
||||
// The WebSocket relay is planned together with the candidate interface of labs; this contract fixes
|
||||
// the session shape it uses.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden), the attempt and the lab (404 not_found for an unknown attempt,
|
||||
// lab, or one of another candidate), the node (400 with the pointer `/node`), the state (409
|
||||
// state_conflict: the lab is not `ready`, the attempt is terminal, or its work session ended), the
|
||||
// limit of open sessions per lab (429 rate_limited with Retry-After), then the provisioner (503
|
||||
// service_unavailable without Retry-After; nothing was opened).
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts/{attempt_id}/labs/{lab_id}/console-sessions
|
||||
func (UnimplementedHandler) CreateMyAssessmentLabConsoleSession(ctx context.Context, req *AssessmentLabConsoleSessionCreate, params CreateMyAssessmentLabConsoleSessionParams) (r CreateMyAssessmentLabConsoleSessionRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// CreateMyAssessmentPracticeRun implements CreateMyAssessmentPracticeRun operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
@@ -725,6 +792,22 @@ func (UnimplementedHandler) GetMyAssessmentAvailability(ctx context.Context) (r
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetMyAssessmentLab implements GetMyAssessmentLab operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. Returns the state of a lab started with
|
||||
// CreateMyAssessmentLab: whether it is still provisioning, ready for the consoles, being checked after
|
||||
// the submission, or ended. It never contains a node address, a credential, the seed, the checker
|
||||
// state, or the result of the check. This GET is read-only; the server may record a due timer
|
||||
// transition, such as `ready` to `expired`, before it answers.
|
||||
//
|
||||
// A lab of another candidate's attempt, a lab of another attempt, and an unknown identifier all answer
|
||||
// 404 not_found.
|
||||
//
|
||||
// GET /api/v1/me/assessment-attempts/{attempt_id}/labs/{lab_id}
|
||||
func (UnimplementedHandler) GetMyAssessmentLab(ctx context.Context, params GetMyAssessmentLabParams) (r GetMyAssessmentLabRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetMyAssessmentPracticeRun implements GetMyAssessmentPracticeRun operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. Returns the state of a debug run started with
|
||||
@@ -2252,6 +2335,10 @@ func (UnimplementedHandler) StartMyAssessmentAttemptSession(ctx context.Context,
|
||||
// times itself and scores the answer with the key of the fixed item instance. Time never enters the
|
||||
// ability estimate or the grade decision.
|
||||
//
|
||||
// Lab: an item with format `lab` takes no answer here. Its lab is started with CreateMyAssessmentLab
|
||||
// and submitted with SubmitMyAssessmentLab; any answer to a lab item answers 400 validation_failed
|
||||
// with the pointer `/answer/format`, like an answer in the wrong format, and stores nothing.
|
||||
//
|
||||
// The response is the attempt with the next item to answer. It never says whether the answer was
|
||||
// correct. Items are answered in order and each answer is final.
|
||||
//
|
||||
@@ -2313,6 +2400,40 @@ func (UnimplementedHandler) SubmitMyAssessmentAnswer(ctx context.Context, req *A
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// SubmitMyAssessmentLab implements SubmitMyAssessmentLab operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// an allowed Origin, and an Idempotency-Key. The body carries the attempt version last read and the
|
||||
// answer with format `lab`, which names the lab.
|
||||
//
|
||||
// The server closes the consoles, freezes the lab, and answers 202 with the lab `checking`; the
|
||||
// checker of the task reads the state of the nodes asynchronously, the answer is recorded, and the lab
|
||||
// becomes `submitted` and is deleted. The client polls GetMyAssessmentLab and then reads the attempt,
|
||||
// which moves to the next item. Neither response says whether the answer was correct, and the
|
||||
// candidate never sees the checker criteria or their results.
|
||||
//
|
||||
// When the checker cannot reach the nodes because of the lab infrastructure, the lab becomes `failed`
|
||||
// with `lab_error`: nothing is recorded or consumed, the attempt version is unchanged, and the
|
||||
// candidate may start a new lab of the item while it is current. A failure of the infrastructure is
|
||||
// never scored as a wrong answer.
|
||||
//
|
||||
// Optimistic concurrency: `expected_version` must equal the current attempt version, otherwise the
|
||||
// server answers 412 version_conflict and stores nothing.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay),
|
||||
// the attempt and the lab (404 not_found for an unknown attempt or lab, or one of another candidate),
|
||||
// the version (412), the state (409 state_conflict: the lab is not `ready`, `answer.lab_id` is not the
|
||||
// lab in the path, the item is not current, the attempt is terminal, or its work session ended), then
|
||||
// the provisioner (503 service_unavailable without Retry-After; nothing was stored and the lab keeps
|
||||
// running). Following the Idempotency-Key convention, 202, 404, and 409 state_conflict are stored
|
||||
// under the key and replayed; 400, 412, 429, and 5xx are not.
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts/{attempt_id}/labs/{lab_id}/submission
|
||||
func (UnimplementedHandler) SubmitMyAssessmentLab(ctx context.Context, req *AssessmentLabSubmission, params SubmitMyAssessmentLabParams) (r SubmitMyAssessmentLabRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// UnhideOrganization implements UnhideOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
|
||||
@@ -3016,6 +3016,347 @@ func (s *AssessmentItem) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AssessmentLab) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.State.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "state",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if s.Nodes == nil {
|
||||
return errors.New("nil is invalid value")
|
||||
}
|
||||
if err := (validate.Array{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 8,
|
||||
MaxLengthSet: true,
|
||||
}).ValidateLength(len(s.Nodes)); err != nil {
|
||||
return errors.Wrap(err, "array")
|
||||
}
|
||||
var failures []validate.FieldError
|
||||
for i, elem := range s.Nodes {
|
||||
if err := func() error {
|
||||
if err := elem.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: fmt.Sprintf("[%d]", i),
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "nodes",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if value, ok := s.FailureReason.Get(); ok {
|
||||
if err := func() error {
|
||||
if err := value.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "failure_reason",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AssessmentLabConsoleSession) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.Node.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "node",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := (validate.String{
|
||||
MinLength: 0,
|
||||
MinLengthSet: false,
|
||||
MaxLength: 128,
|
||||
MaxLengthSet: true,
|
||||
Email: false,
|
||||
Hostname: false,
|
||||
Regex: regexMap["^/api/v1/me/assessment-lab-consoles/[0-9a-f-]{36}$"],
|
||||
MinNumeric: 0,
|
||||
MinNumericSet: false,
|
||||
MaxNumeric: 0,
|
||||
MaxNumericSet: false,
|
||||
}).Validate(string(s.WebsocketPath)); err != nil {
|
||||
return errors.Wrap(err, "string")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "websocket_path",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AssessmentLabConsoleSessionCreate) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.Node.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "node",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AssessmentLabConsoleSessionHeaders) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.CacheControl.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "CacheControl",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Response.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "Response",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s AssessmentLabFailureReason) Validate() error {
|
||||
switch s {
|
||||
case "lab_error":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *AssessmentLabHeaders) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.CacheControl.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "CacheControl",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Response.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "Response",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AssessmentLabNode) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.Name.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "name",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Kind.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "kind",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s AssessmentLabNodeKind) Validate() error {
|
||||
switch s {
|
||||
case "mikrotik":
|
||||
return nil
|
||||
case "ubuntu":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s AssessmentLabNodeName) Validate() error {
|
||||
alias := (string)(s)
|
||||
if err := (validate.String{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 15,
|
||||
MaxLengthSet: true,
|
||||
Email: false,
|
||||
Hostname: false,
|
||||
Regex: regexMap["^[a-z][a-z0-9-]{0,14}$"],
|
||||
MinNumeric: 0,
|
||||
MinNumericSet: false,
|
||||
MaxNumeric: 0,
|
||||
MaxNumericSet: false,
|
||||
}).Validate(string(alias)); err != nil {
|
||||
return errors.Wrap(err, "string")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s AssessmentLabState) Validate() error {
|
||||
switch s {
|
||||
case "provisioning":
|
||||
return nil
|
||||
case "ready":
|
||||
return nil
|
||||
case "checking":
|
||||
return nil
|
||||
case "submitted":
|
||||
return nil
|
||||
case "expired":
|
||||
return nil
|
||||
case "failed":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *AssessmentLabSubmission) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.ExpectedVersion.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "expected_version",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Answer.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "answer",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s AssessmentLimitation) Validate() error {
|
||||
switch s {
|
||||
case "uncalibrated_thresholds":
|
||||
@@ -8873,6 +9214,110 @@ func (s *CreateMyAssessmentAttemptUnprocessableEntity) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabBadRequest) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabConflict) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabConsoleSessionBadRequest) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabConsoleSessionConflict) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabConsoleSessionForbidden) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabConsoleSessionNotFound) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabConsoleSessionUnauthorized) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabCreated) Validate() error {
|
||||
alias := (*AssessmentLabHeaders)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabForbidden) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabNotFound) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabOK) Validate() error {
|
||||
alias := (*AssessmentLabHeaders)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabUnauthorized) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentLabUnprocessableEntity) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *CreateMyAssessmentPracticeRunBadRequest) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
@@ -10120,6 +10565,30 @@ func (s *GetMyAssessmentAvailabilityUnauthorized) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GetMyAssessmentLabForbidden) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GetMyAssessmentLabNotFound) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GetMyAssessmentLabUnauthorized) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GetMyAssessmentPracticeRunForbidden) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
@@ -11906,11 +12375,137 @@ func (s ItemContent) Validate() error {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
case LabItemContentItemContent:
|
||||
if err := s.LabItemContent.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid type %q", s.Type)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *LabAnswer) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.Format.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "format",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s LabAnswerFormat) Validate() error {
|
||||
switch s {
|
||||
case "lab":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *LabItemContent) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.Format.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "format",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if s.Nodes == nil {
|
||||
return errors.New("nil is invalid value")
|
||||
}
|
||||
if err := (validate.Array{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 8,
|
||||
MaxLengthSet: true,
|
||||
}).ValidateLength(len(s.Nodes)); err != nil {
|
||||
return errors.Wrap(err, "array")
|
||||
}
|
||||
var failures []validate.FieldError
|
||||
for i, elem := range s.Nodes {
|
||||
if err := func() error {
|
||||
if err := elem.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: fmt.Sprintf("[%d]", i),
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "nodes",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := (validate.Int{
|
||||
MinSet: true,
|
||||
Min: 300,
|
||||
MaxSet: true,
|
||||
Max: 14400,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
MultipleOf: 0,
|
||||
Pattern: nil,
|
||||
}).Validate(int64(s.TimeLimitSeconds)); err != nil {
|
||||
return errors.Wrap(err, "int")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "time_limit_seconds",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s LabItemContentFormat) Validate() error {
|
||||
switch s {
|
||||
case "lab":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ListMyAssessmentResultsBadRequest) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
@@ -24811,6 +25406,62 @@ func (s *SubmitMyAssessmentAnswerUnprocessableEntity) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SubmitMyAssessmentLabBadRequest) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SubmitMyAssessmentLabConflict) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SubmitMyAssessmentLabForbidden) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SubmitMyAssessmentLabNotFound) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SubmitMyAssessmentLabPreconditionFailed) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SubmitMyAssessmentLabUnauthorized) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SubmitMyAssessmentLabUnprocessableEntity) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SupportCase) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
|
||||
Reference in new issue
Block a user