From 907cb25ceb37330115b8c14b48c605697e942da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Jerman?= Date: Mon, 20 Dec 2021 15:20:36 +0100 Subject: [PATCH] Add support for multipart/form-data request parsing --- automation/rest/request/permissions.go | 10 + automation/rest/request/session.go | 21 ++ automation/rest/request/trigger.go | 198 ++++++++++++++ automation/rest/request/workflow.go | 299 +++++++++++++++++++++ compose/rest/request/automation.go | 16 ++ compose/rest/request/chart.go | 91 +++++++ compose/rest/request/module.go | 117 ++++++++ compose/rest/request/namespace.go | 199 ++++++++++++++ compose/rest/request/notification.go | 31 +++ compose/rest/request/page.go | 201 ++++++++++++++ compose/rest/request/permissions.go | 10 + compose/rest/request/record.go | 160 +++++++++++ federation/rest/request/manageStructure.go | 100 +++++++ federation/rest/request/node.go | 83 ++++++ federation/rest/request/nodeHandshake.go | 30 +++ federation/rest/request/permissions.go | 10 + pkg/codegen/assets/rest_request.go.tpl | 36 +++ system/rest/request/apigwFilter.go | 112 ++++++++ system/rest/request/apigwRoute.go | 98 +++++++ system/rest/request/application.go | 149 ++++++++++ system/rest/request/auth.go | 16 ++ system/rest/request/authClient.go | 202 ++++++++++++++ system/rest/request/automation.go | 16 ++ system/rest/request/locale.go | 102 +++++++ system/rest/request/permissions.go | 10 + system/rest/request/queues.go | 70 +++++ system/rest/request/reminder.go | 90 +++++++ system/rest/request/report.go | 100 +++++++ system/rest/request/role.go | 142 ++++++++++ system/rest/request/settings.go | 28 ++ system/rest/request/template.go | 173 ++++++++++++ system/rest/request/user.go | 130 +++++++++ 32 files changed, 3050 insertions(+) diff --git a/automation/rest/request/permissions.go b/automation/rest/request/permissions.go index 3241cae68..e02e560f9 100644 --- a/automation/rest/request/permissions.go +++ b/automation/rest/request/permissions.go @@ -229,6 +229,16 @@ func (r *PermissionsUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/automation/rest/request/session.go b/automation/rest/request/session.go index ffbef4de2..4a62d4a1e 100644 --- a/automation/rest/request/session.go +++ b/automation/rest/request/session.go @@ -468,6 +468,27 @@ func (r *SessionResumeState) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["input[]"]; ok { + r.Input, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["input"]; ok { + r.Input, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/automation/rest/request/trigger.go b/automation/rest/request/trigger.go index 610a08662..39ef415bd 100644 --- a/automation/rest/request/trigger.go +++ b/automation/rest/request/trigger.go @@ -479,6 +479,105 @@ func (r *TriggerCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["eventType"]; ok && len(val) > 0 { + r.EventType, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["resourceType"]; ok && len(val) > 0 { + r.ResourceType, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["workflowID"]; ok && len(val) > 0 { + r.WorkflowID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["workflowStepID"]; ok && len(val) > 0 { + r.WorkflowStepID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["input[]"]; ok { + r.Input, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["input"]; ok { + r.Input, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseTriggerMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseTriggerMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["constraints[]"]; ok { + r.Constraints, err = types.ParseTriggerConstraintSet(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["constraints"]; ok { + r.Constraints, err = types.ParseTriggerConstraintSet(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ownedBy"]; ok && len(val) > 0 { + r.OwnedBy, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -671,6 +770,105 @@ func (r *TriggerUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["eventType"]; ok && len(val) > 0 { + r.EventType, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["resourceType"]; ok && len(val) > 0 { + r.ResourceType, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["workflowID"]; ok && len(val) > 0 { + r.WorkflowID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["workflowStepID"]; ok && len(val) > 0 { + r.WorkflowStepID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["input[]"]; ok { + r.Input, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["input"]; ok { + r.Input, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseTriggerMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseTriggerMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["constraints[]"]; ok { + r.Constraints, err = types.ParseTriggerConstraintSet(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["constraints"]; ok { + r.Constraints, err = types.ParseTriggerConstraintSet(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ownedBy"]; ok && len(val) > 0 { + r.OwnedBy, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/automation/rest/request/workflow.go b/automation/rest/request/workflow.go index e438a657d..436cc03a2 100644 --- a/automation/rest/request/workflow.go +++ b/automation/rest/request/workflow.go @@ -488,6 +488,117 @@ func (r *WorkflowCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseWorkflowMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseWorkflowMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["trace"]; ok && len(val) > 0 { + r.Trace, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["keepSessions"]; ok && len(val) > 0 { + r.KeepSessions, err = payload.ParseInt(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["scope[]"]; ok { + r.Scope, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["scope"]; ok { + r.Scope, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["steps[]"]; ok { + r.Steps, err = types.ParseWorkflowStepSet(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["steps"]; ok { + r.Steps, err = types.ParseWorkflowStepSet(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["paths[]"]; ok { + r.Paths, err = types.ParseWorkflowPathSet(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["paths"]; ok { + r.Paths, err = types.ParseWorkflowPathSet(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["runAs"]; ok && len(val) > 0 { + r.RunAs, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ownedBy"]; ok && len(val) > 0 { + r.OwnedBy, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -698,6 +809,117 @@ func (r *WorkflowUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseWorkflowMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseWorkflowMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["trace"]; ok && len(val) > 0 { + r.Trace, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["keepSessions"]; ok && len(val) > 0 { + r.KeepSessions, err = payload.ParseInt(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["scope[]"]; ok { + r.Scope, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["scope"]; ok { + r.Scope, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["steps[]"]; ok { + r.Steps, err = types.ParseWorkflowStepSet(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["steps"]; ok { + r.Steps, err = types.ParseWorkflowStepSet(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["paths[]"]; ok { + r.Paths, err = types.ParseWorkflowPathSet(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["paths"]; ok { + r.Paths, err = types.ParseWorkflowPathSet(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["runAs"]; ok && len(val) > 0 { + r.RunAs, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ownedBy"]; ok && len(val) > 0 { + r.OwnedBy, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -971,6 +1193,34 @@ func (r *WorkflowTest) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["scope[]"]; ok { + r.Scope, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["scope"]; ok { + r.Scope, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["runAs"]; ok && len(val) > 0 { + r.RunAs, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1074,6 +1324,55 @@ func (r *WorkflowExec) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["stepID"]; ok && len(val) > 0 { + r.StepID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["input[]"]; ok { + r.Input, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["input"]; ok { + r.Input, err = types.ParseWorkflowVariables(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["trace"]; ok && len(val) > 0 { + r.Trace, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["wait"]; ok && len(val) > 0 { + r.Wait, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["async"]; ok && len(val) > 0 { + r.Async, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/compose/rest/request/automation.go b/compose/rest/request/automation.go index 56d5f2856..f097f6761 100644 --- a/compose/rest/request/automation.go +++ b/compose/rest/request/automation.go @@ -301,6 +301,22 @@ func (r *AutomationTriggerScript) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/compose/rest/request/chart.go b/compose/rest/request/chart.go index d03addd58..8aca18788 100644 --- a/compose/rest/request/chart.go +++ b/compose/rest/request/chart.go @@ -335,6 +335,48 @@ func (r *ChartCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["config"]; ok && len(val) > 0 { + r.Config, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -505,6 +547,55 @@ func (r *ChartUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["config"]; ok && len(val) > 0 { + r.Config, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["updatedAt"]; ok && len(val) > 0 { + r.UpdatedAt, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/compose/rest/request/module.go b/compose/rest/request/module.go index 8d1e66bbf..f1867764e 100644 --- a/compose/rest/request/module.go +++ b/compose/rest/request/module.go @@ -421,6 +421,48 @@ func (r *ModuleCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta"]; ok && len(val) > 0 { + r.Meta, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -604,6 +646,55 @@ func (r *ModuleUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta"]; ok && len(val) > 0 { + r.Meta, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["updatedAt"]; ok && len(val) > 0 { + r.UpdatedAt, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -776,6 +867,22 @@ func (r *ModuleTriggerScript) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -914,6 +1021,16 @@ func (r *ModuleUpdateTranslations) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/compose/rest/request/namespace.go b/compose/rest/request/namespace.go index c146a7092..407059646 100644 --- a/compose/rest/request/namespace.go +++ b/compose/rest/request/namespace.go @@ -404,6 +404,55 @@ func (r *NamespaceCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["slug"]; ok && len(val) > 0 { + r.Slug, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta"]; ok && len(val) > 0 { + r.Meta, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -557,6 +606,62 @@ func (r *NamespaceUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["slug"]; ok && len(val) > 0 { + r.Slug, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta"]; ok && len(val) > 0 { + r.Meta, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["updatedAt"]; ok && len(val) > 0 { + r.UpdatedAt, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -693,6 +798,17 @@ func (r *NamespaceUpload) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + // Ignoring upload as its handled in the POST params section + } + } + { if err = req.ParseForm(); err != nil { return err @@ -752,6 +868,29 @@ func (r *NamespaceClone) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["slug"]; ok && len(val) > 0 { + r.Slug, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -879,6 +1018,17 @@ func (r *NamespaceImportInit) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + // Ignoring upload as its handled in the POST params section + } + } + { if err = req.ParseForm(); err != nil { return err @@ -938,6 +1088,29 @@ func (r *NamespaceImportRun) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["slug"]; ok && len(val) > 0 { + r.Slug, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1018,6 +1191,22 @@ func (r *NamespaceTriggerScript) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1132,6 +1321,16 @@ func (r *NamespaceUpdateTranslations) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/compose/rest/request/notification.go b/compose/rest/request/notification.go index a6dd41463..4452ad30c 100644 --- a/compose/rest/request/notification.go +++ b/compose/rest/request/notification.go @@ -128,6 +128,37 @@ func (r *NotificationEmailSend) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["replyTo"]; ok && len(val) > 0 { + r.ReplyTo, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["subject"]; ok && len(val) > 0 { + r.Subject, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["content"]; ok && len(val) > 0 { + r.Content, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/compose/rest/request/page.go b/compose/rest/request/page.go index 83cf99a86..b2dc910fd 100644 --- a/compose/rest/request/page.go +++ b/compose/rest/request/page.go @@ -536,6 +536,83 @@ func (r *PageCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["selfID"]; ok && len(val) > 0 { + r.SelfID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["moduleID"]; ok && len(val) > 0 { + r.ModuleID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["title"]; ok && len(val) > 0 { + r.Title, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["description"]; ok && len(val) > 0 { + r.Description, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["weight"]; ok && len(val) > 0 { + r.Weight, err = payload.ParseInt(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["visible"]; ok && len(val) > 0 { + r.Visible, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["blocks"]; ok && len(val) > 0 { + r.Blocks, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -800,6 +877,83 @@ func (r *PageUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["selfID"]; ok && len(val) > 0 { + r.SelfID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["moduleID"]; ok && len(val) > 0 { + r.ModuleID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["title"]; ok && len(val) > 0 { + r.Title, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["description"]; ok && len(val) > 0 { + r.Description, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["weight"]; ok && len(val) > 0 { + r.Weight, err = payload.ParseInt(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["visible"]; ok && len(val) > 0 { + r.Visible, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["blocks"]; ok && len(val) > 0 { + r.Blocks, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -940,6 +1094,16 @@ func (r *PageReorder) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1066,6 +1230,17 @@ func (r *PageUpload) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + // Ignoring upload as its handled in the POST params section + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1149,6 +1324,22 @@ func (r *PageTriggerScript) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1287,6 +1478,16 @@ func (r *PageUpdateTranslations) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/compose/rest/request/permissions.go b/compose/rest/request/permissions.go index 3241cae68..e02e560f9 100644 --- a/compose/rest/request/permissions.go +++ b/compose/rest/request/permissions.go @@ -229,6 +229,16 @@ func (r *PermissionsUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/compose/rest/request/record.go b/compose/rest/request/record.go index 96e368323..5217e7f0c 100644 --- a/compose/rest/request/record.go +++ b/compose/rest/request/record.go @@ -712,6 +712,17 @@ func (r *RecordImportInit) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + // Ignoring upload as its handled in the POST params section + } + } + { if err = req.ParseForm(); err != nil { return err @@ -801,6 +812,29 @@ func (r *RecordImportRun) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["fields"]; ok && len(val) > 0 { + r.Fields, err = json.RawMessage(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["onError"]; ok && len(val) > 0 { + r.OnError, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1076,6 +1110,16 @@ func (r *RecordExec) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1173,6 +1217,27 @@ func (r *RecordCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1348,6 +1413,27 @@ func (r *RecordUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1458,6 +1544,22 @@ func (r *RecordBulkDelete) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["truncate"]; ok && len(val) > 0 { + r.Truncate, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1615,6 +1717,31 @@ func (r *RecordUpload) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["recordID"]; ok && len(val) > 0 { + r.RecordID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["fieldName"]; ok && len(val) > 0 { + r.FieldName, err = val[0], nil + if err != nil { + return err + } + } + + // Ignoring upload as its handled in the POST params section + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1718,6 +1845,23 @@ func (r *RecordTriggerScript) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1816,6 +1960,22 @@ func (r *RecordTriggerScriptOnList) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/federation/rest/request/manageStructure.go b/federation/rest/request/manageStructure.go index 695a61caa..f42cbac94 100644 --- a/federation/rest/request/manageStructure.go +++ b/federation/rest/request/manageStructure.go @@ -314,6 +314,44 @@ func (r *ManageStructureCreateExposed) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["composeModuleID"]; ok && len(val) > 0 { + r.ComposeModuleID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["composeNamespaceID"]; ok && len(val) > 0 { + r.ComposeNamespaceID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + } + } + { if err = req.ParseForm(); err != nil { return err @@ -439,6 +477,44 @@ func (r *ManageStructureUpdateExposed) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["composeModuleID"]; ok && len(val) > 0 { + r.ComposeModuleID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["composeNamespaceID"]; ok && len(val) > 0 { + r.ComposeNamespaceID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + } + } + { if err = req.ParseForm(); err != nil { return err @@ -652,6 +728,30 @@ func (r *ManageStructureCreateMappings) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["composeModuleID"]; ok && len(val) > 0 { + r.ComposeModuleID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["composeNamespaceID"]; ok && len(val) > 0 { + r.ComposeNamespaceID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/federation/rest/request/node.go b/federation/rest/request/node.go index 73c171ece..f7aacabbe 100644 --- a/federation/rest/request/node.go +++ b/federation/rest/request/node.go @@ -240,6 +240,43 @@ func (r *NodeCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["baseURL"]; ok && len(val) > 0 { + r.BaseURL, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["contact"]; ok && len(val) > 0 { + r.Contact, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["pairingURI"]; ok && len(val) > 0 { + r.PairingURI, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -398,6 +435,36 @@ func (r *NodeUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["contact"]; ok && len(val) > 0 { + r.Contact, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["baseURL"]; ok && len(val) > 0 { + r.BaseURL, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -619,6 +686,22 @@ func (r *NodeHandshakeComplete) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["authToken"]; ok && len(val) > 0 { + r.AuthToken, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/federation/rest/request/nodeHandshake.go b/federation/rest/request/nodeHandshake.go index 65d3bae3f..cd7d135d9 100644 --- a/federation/rest/request/nodeHandshake.go +++ b/federation/rest/request/nodeHandshake.go @@ -105,6 +105,36 @@ func (r *NodeHandshakeInitialize) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["pairToken"]; ok && len(val) > 0 { + r.PairToken, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["sharedNodeID"]; ok && len(val) > 0 { + r.SharedNodeID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["authToken"]; ok && len(val) > 0 { + r.AuthToken, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/federation/rest/request/permissions.go b/federation/rest/request/permissions.go index 3241cae68..e02e560f9 100644 --- a/federation/rest/request/permissions.go +++ b/federation/rest/request/permissions.go @@ -229,6 +229,16 @@ func (r *PermissionsUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/pkg/codegen/assets/rest_request.go.tpl b/pkg/codegen/assets/rest_request.go.tpl index 7a54724bf..63f70e10a 100644 --- a/pkg/codegen/assets/rest_request.go.tpl +++ b/pkg/codegen/assets/rest_request.go.tpl @@ -120,6 +120,42 @@ func (r *{{ export $.Endpoint.Entrypoint $a.Name }}) Fill(req *http.Request) (er {{- end }} {{ if $a.Params.Post }} + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + {{ range $p := $a.Params.Post }} + {{ if $p.IsUpload }} + // Ignoring {{ $p.Name }} as its handled in the POST params section + {{- else }} + {{- if or $p.HasExplicitParser }} + if val, ok := req.MultipartForm.Value["{{ $p.Name }}[]"]; ok { + r.{{ export $p.Name }}, err = {{ $p.Parser "val" }} + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["{{ $p.Name }}"]; ok { + r.{{ export $p.Name }}, err = {{ $p.Parser "val" }} + if err != nil { + return err + } + } + {{- else if not $p.IsSlice }} + if val, ok := req.MultipartForm.Value["{{ $p.Name }}"]; ok && len(val) > 0 { + r.{{ export $p.Name }}, err = {{ $p.Parser "val[0]" }} + if err != nil { + return err + } + } + {{- end }} + {{- end }} + + {{- end }} + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/apigwFilter.go b/system/rest/request/apigwFilter.go index 284763294..e306626f0 100644 --- a/system/rest/request/apigwFilter.go +++ b/system/rest/request/apigwFilter.go @@ -323,6 +323,62 @@ func (r *ApigwFilterCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["routeID"]; ok && len(val) > 0 { + r.RouteID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["weight"]; ok && len(val) > 0 { + r.Weight, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["kind"]; ok && len(val) > 0 { + r.Kind, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ref"]; ok && len(val) > 0 { + r.Ref, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["params[]"]; ok { + r.Params, err = types.ParseApigwfFilterParams(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["params"]; ok { + r.Params, err = types.ParseApigwfFilterParams(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -448,6 +504,62 @@ func (r *ApigwFilterUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["routeID"]; ok && len(val) > 0 { + r.RouteID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["weight"]; ok && len(val) > 0 { + r.Weight, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["kind"]; ok && len(val) > 0 { + r.Kind, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ref"]; ok && len(val) > 0 { + r.Ref, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["params[]"]; ok { + r.Params, err = types.ParseApigwfFilterParams(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["params"]; ok { + r.Params, err = types.ParseApigwfFilterParams(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/apigwRoute.go b/system/rest/request/apigwRoute.go index bbf58eb36..3b01558a8 100644 --- a/system/rest/request/apigwRoute.go +++ b/system/rest/request/apigwRoute.go @@ -342,6 +342,55 @@ func (r *ApigwRouteCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["endpoint"]; ok && len(val) > 0 { + r.Endpoint, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["method"]; ok && len(val) > 0 { + r.Method, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["group"]; ok && len(val) > 0 { + r.Group, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseApigwRouteMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseApigwRouteMeta(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -454,6 +503,55 @@ func (r *ApigwRouteUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["endpoint"]; ok && len(val) > 0 { + r.Endpoint, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["method"]; ok && len(val) > 0 { + r.Method, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["group"]; ok && len(val) > 0 { + r.Group, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseApigwRouteMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseApigwRouteMeta(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/application.go b/system/rest/request/application.go index a342f58a9..96487599d 100644 --- a/system/rest/request/application.go +++ b/system/rest/request/application.go @@ -445,6 +445,62 @@ func (r *ApplicationCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["weight"]; ok && len(val) > 0 { + r.Weight, err = payload.ParseInt(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["unify"]; ok && len(val) > 0 { + r.Unify, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["config"]; ok && len(val) > 0 { + r.Config, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -570,6 +626,62 @@ func (r *ApplicationUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["weight"]; ok && len(val) > 0 { + r.Weight, err = payload.ParseInt(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["unify"]; ok && len(val) > 0 { + r.Unify, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["config"]; ok && len(val) > 0 { + r.Config, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -671,6 +783,17 @@ func (r *ApplicationUpload) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + // Ignoring upload as its handled in the POST params section + } + } + { if err = req.ParseForm(); err != nil { return err @@ -971,6 +1094,22 @@ func (r *ApplicationTriggerScript) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1044,6 +1183,16 @@ func (r *ApplicationReorder) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/auth.go b/system/rest/request/auth.go index ed7a7d6fb..8b40f366c 100644 --- a/system/rest/request/auth.go +++ b/system/rest/request/auth.go @@ -72,6 +72,22 @@ func (r *AuthImpersonate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["userID"]; ok && len(val) > 0 { + r.UserID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/authClient.go b/system/rest/request/authClient.go index c22fac9a5..2827b4430 100644 --- a/system/rest/request/authClient.go +++ b/system/rest/request/authClient.go @@ -414,6 +414,107 @@ func (r *AuthClientCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseAuthClientMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseAuthClientMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["validGrant"]; ok && len(val) > 0 { + r.ValidGrant, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["redirectURI"]; ok && len(val) > 0 { + r.RedirectURI, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["scope"]; ok && len(val) > 0 { + r.Scope, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["trusted"]; ok && len(val) > 0 { + r.Trusted, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["validFrom"]; ok && len(val) > 0 { + r.ValidFrom, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["expiresAt"]; ok && len(val) > 0 { + r.ExpiresAt, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["security[]"]; ok { + r.Security, err = types.ParseAuthClientSecurity(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["security"]; ok { + r.Security, err = types.ParseAuthClientSecurity(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -614,6 +715,107 @@ func (r *AuthClientUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseAuthClientMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseAuthClientMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["validGrant"]; ok && len(val) > 0 { + r.ValidGrant, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["redirectURI"]; ok && len(val) > 0 { + r.RedirectURI, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["scope"]; ok && len(val) > 0 { + r.Scope, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["trusted"]; ok && len(val) > 0 { + r.Trusted, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["enabled"]; ok && len(val) > 0 { + r.Enabled, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["validFrom"]; ok && len(val) > 0 { + r.ValidFrom, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["expiresAt"]; ok && len(val) > 0 { + r.ExpiresAt, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["security[]"]; ok { + r.Security, err = types.ParseAuthClientSecurity(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["security"]; ok { + r.Security, err = types.ParseAuthClientSecurity(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/automation.go b/system/rest/request/automation.go index 56d5f2856..f097f6761 100644 --- a/system/rest/request/automation.go +++ b/system/rest/request/automation.go @@ -301,6 +301,22 @@ func (r *AutomationTriggerScript) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/locale.go b/system/rest/request/locale.go index 73073b82a..201062a45 100644 --- a/system/rest/request/locale.go +++ b/system/rest/request/locale.go @@ -361,6 +361,57 @@ func (r *LocaleCreateResource) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["lang"]; ok && len(val) > 0 { + r.Lang, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["resource"]; ok && len(val) > 0 { + r.Resource, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["key"]; ok && len(val) > 0 { + r.Key, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["place"]; ok && len(val) > 0 { + r.Place, err = payload.ParseInt(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["message"]; ok && len(val) > 0 { + r.Message, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ownerID"]; ok && len(val) > 0 { + r.OwnerID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -481,6 +532,57 @@ func (r *LocaleUpdateResource) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["lang"]; ok && len(val) > 0 { + r.Lang, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["resource"]; ok && len(val) > 0 { + r.Resource, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["key"]; ok && len(val) > 0 { + r.Key, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["place"]; ok && len(val) > 0 { + r.Place, err = payload.ParseInt(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["message"]; ok && len(val) > 0 { + r.Message, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ownerID"]; ok && len(val) > 0 { + r.OwnerID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/permissions.go b/system/rest/request/permissions.go index 296ffb822..674cead0c 100644 --- a/system/rest/request/permissions.go +++ b/system/rest/request/permissions.go @@ -241,6 +241,16 @@ func (r *PermissionsUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/queues.go b/system/rest/request/queues.go index 703278102..617139675 100644 --- a/system/rest/request/queues.go +++ b/system/rest/request/queues.go @@ -248,6 +248,41 @@ func (r *QueuesCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["queue"]; ok && len(val) > 0 { + r.Queue, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["consumer"]; ok && len(val) > 0 { + r.Consumer, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseQueueMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseQueueMeta(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -369,6 +404,41 @@ func (r *QueuesUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["queue"]; ok && len(val) > 0 { + r.Queue, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["consumer"]; ok && len(val) > 0 { + r.Consumer, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseQueueMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseQueueMeta(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/reminder.go b/system/rest/request/reminder.go index 48a7f59ab..48c974b37 100644 --- a/system/rest/request/reminder.go +++ b/system/rest/request/reminder.go @@ -384,6 +384,43 @@ func (r *ReminderCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["resource"]; ok && len(val) > 0 { + r.Resource, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["assignedTo"]; ok && len(val) > 0 { + r.AssignedTo, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["payload"]; ok && len(val) > 0 { + r.Payload, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["remindAt"]; ok && len(val) > 0 { + r.RemindAt, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -478,6 +515,43 @@ func (r *ReminderUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["resource"]; ok && len(val) > 0 { + r.Resource, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["assignedTo"]; ok && len(val) > 0 { + r.AssignedTo, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["payload"]; ok && len(val) > 0 { + r.Payload, err = payload.ParseJSONTextWithErr(val[0]) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["remindAt"]; ok && len(val) > 0 { + r.RemindAt, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -671,6 +745,22 @@ func (r *ReminderSnooze) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["remindAt"]; ok && len(val) > 0 { + r.RemindAt, err = payload.ParseISODatePtrWithErr(val[0]) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/report.go b/system/rest/request/report.go index b49452d59..c35c2455f 100644 --- a/system/rest/request/report.go +++ b/system/rest/request/report.go @@ -349,6 +349,46 @@ func (r *ReportCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseReportMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseReportMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -479,6 +519,46 @@ func (r *ReportUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseReportMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseReportMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -702,6 +782,16 @@ func (r *ReportDescribe) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err @@ -771,6 +861,16 @@ func (r *ReportRun) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/role.go b/system/rest/request/role.go index 4892bcb6c..60886db66 100644 --- a/system/rest/request/role.go +++ b/system/rest/request/role.go @@ -423,6 +423,53 @@ func (r *RoleCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseRoleMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseRoleMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -540,6 +587,53 @@ func (r *RoleUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseRoleMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseRoleMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -820,6 +914,22 @@ func (r *RoleMove) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["organisationID"]; ok && len(val) > 0 { + r.OrganisationID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -887,6 +997,22 @@ func (r *RoleMerge) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["destination"]; ok && len(val) > 0 { + r.Destination, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1089,6 +1215,22 @@ func (r *RoleTriggerScript) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/settings.go b/system/rest/request/settings.go index e92bc9e98..b8c5fa343 100644 --- a/system/rest/request/settings.go +++ b/system/rest/request/settings.go @@ -147,6 +147,16 @@ func (r *SettingsUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + } + } + { if err = req.ParseForm(); err != nil { return err @@ -261,6 +271,24 @@ func (r *SettingsSet) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + // Ignoring upload as its handled in the POST params section + + if val, ok := req.MultipartForm.Value["ownerID"]; ok && len(val) > 0 { + r.OwnerID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/template.go b/system/rest/request/template.go index f11792825..5c72a26a0 100644 --- a/system/rest/request/template.go +++ b/system/rest/request/template.go @@ -432,6 +432,81 @@ func (r *TemplateCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["language"]; ok && len(val) > 0 { + r.Language, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["type"]; ok && len(val) > 0 { + r.Type, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["partial"]; ok && len(val) > 0 { + r.Partial, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseTemplateMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseTemplateMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["template"]; ok && len(val) > 0 { + r.Template, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ownerID"]; ok && len(val) > 0 { + r.OwnerID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -623,6 +698,81 @@ func (r *TemplateUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["language"]; ok && len(val) > 0 { + r.Language, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["type"]; ok && len(val) > 0 { + r.Type, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["partial"]; ok && len(val) > 0 { + r.Partial, err = payload.ParseBool(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["meta[]"]; ok { + r.Meta, err = types.ParseTemplateMeta(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["meta"]; ok { + r.Meta, err = types.ParseTemplateMeta(val) + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["template"]; ok && len(val) > 0 { + r.Template, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["ownerID"]; ok && len(val) > 0 { + r.OwnerID, err = payload.ParseUint64(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -853,6 +1003,29 @@ func (r *TemplateRender) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["variables"]; ok && len(val) > 0 { + r.Variables, err = json.RawMessage(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["options"]; ok && len(val) > 0 { + r.Options, err = json.RawMessage(val[0]), nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err diff --git a/system/rest/request/user.go b/system/rest/request/user.go index c6549ddfa..f879ee46a 100644 --- a/system/rest/request/user.go +++ b/system/rest/request/user.go @@ -554,6 +554,55 @@ func (r *UserCreate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["email"]; ok && len(val) > 0 { + r.Email, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["kind"]; ok && len(val) > 0 { + r.Kind, err = types.UserKind(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -666,6 +715,55 @@ func (r *UserUpdate) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["email"]; ok && len(val) > 0 { + r.Email, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["name"]; ok && len(val) > 0 { + r.Name, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["handle"]; ok && len(val) > 0 { + r.Handle, err = val[0], nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["kind"]; ok && len(val) > 0 { + r.Kind, err = types.UserKind(val[0]), nil + if err != nil { + return err + } + } + + if val, ok := req.MultipartForm.Value["labels[]"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } else if val, ok := req.MultipartForm.Value["labels"]; ok { + r.Labels, err = label.ParseStrings(val) + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -975,6 +1073,22 @@ func (r *UserSetPassword) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["password"]; ok && len(val) > 0 { + r.Password, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err @@ -1177,6 +1291,22 @@ func (r *UserTriggerScript) Fill(req *http.Request) (err error) { } } + { + // Caching 32MB to memory, the rest to disk + if err = req.ParseMultipartForm(32 << 20); err != nil && err != http.ErrNotMultipart { + return err + } else if err == nil { + // Multipart params + + if val, ok := req.MultipartForm.Value["script"]; ok && len(val) > 0 { + r.Script, err = val[0], nil + if err != nil { + return err + } + } + } + } + { if err = req.ParseForm(); err != nil { return err