snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
This commit is contained in:
494
server/automation/rest/request/session.go
Normal file
494
server/automation/rest/request/session.go
Normal file
@@ -0,0 +1,494 @@
|
||||
package request
|
||||
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
//
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cortezaproject/corteza/server/automation/types"
|
||||
"github.com/cortezaproject/corteza/server/pkg/expr"
|
||||
"github.com/cortezaproject/corteza/server/pkg/payload"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// dummy vars to prevent
|
||||
// unused imports complain
|
||||
var (
|
||||
_ = chi.URLParam
|
||||
_ = multipart.ErrMessageTooLarge
|
||||
_ = payload.ParseUint64s
|
||||
_ = strings.ToLower
|
||||
_ = io.EOF
|
||||
_ = fmt.Errorf
|
||||
_ = json.NewEncoder
|
||||
)
|
||||
|
||||
type (
|
||||
// Internal API interface
|
||||
SessionList struct {
|
||||
// SessionID GET parameter
|
||||
//
|
||||
// Filter by session ID
|
||||
SessionID []string
|
||||
|
||||
// WorkflowID GET parameter
|
||||
//
|
||||
// Filter by workflow ID
|
||||
WorkflowID []string
|
||||
|
||||
// CreatedBy GET parameter
|
||||
//
|
||||
// Filter by creators ID
|
||||
CreatedBy []string
|
||||
|
||||
// Completed GET parameter
|
||||
//
|
||||
// Exclude (0, default), include (1) or return only (2) completed sessions
|
||||
Completed uint
|
||||
|
||||
// Status GET parameter
|
||||
//
|
||||
// Filter by status: started (0), prompted (1), suspended (2), failed (3) and completed (4)
|
||||
Status []uint
|
||||
|
||||
// EventType GET parameter
|
||||
//
|
||||
// Filter event type
|
||||
EventType string
|
||||
|
||||
// ResourceType GET parameter
|
||||
//
|
||||
// Filter resource type
|
||||
ResourceType string
|
||||
|
||||
// Limit GET parameter
|
||||
//
|
||||
// Limit
|
||||
Limit uint
|
||||
|
||||
// IncTotal GET parameter
|
||||
//
|
||||
// Include total rows counter
|
||||
IncTotal bool
|
||||
|
||||
// PageCursor GET parameter
|
||||
//
|
||||
// Page cursor
|
||||
PageCursor string
|
||||
|
||||
// Sort GET parameter
|
||||
//
|
||||
// Sort items
|
||||
Sort string
|
||||
}
|
||||
|
||||
SessionRead struct {
|
||||
// SessionID PATH parameter
|
||||
//
|
||||
// Session ID
|
||||
SessionID uint64 `json:",string"`
|
||||
}
|
||||
|
||||
SessionCancel struct {
|
||||
// SessionID PATH parameter
|
||||
//
|
||||
// Session ID
|
||||
SessionID uint64 `json:",string"`
|
||||
}
|
||||
|
||||
SessionListPrompts struct {
|
||||
}
|
||||
|
||||
SessionResumeState struct {
|
||||
// SessionID PATH parameter
|
||||
//
|
||||
// Session ID
|
||||
SessionID uint64 `json:",string"`
|
||||
|
||||
// StateID PATH parameter
|
||||
//
|
||||
// State ID
|
||||
StateID uint64 `json:",string"`
|
||||
|
||||
// Input POST parameter
|
||||
//
|
||||
// Prompt variables
|
||||
Input *expr.Vars
|
||||
}
|
||||
)
|
||||
|
||||
// NewSessionList request
|
||||
func NewSessionList() *SessionList {
|
||||
return &SessionList{}
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"sessionID": r.SessionID,
|
||||
"workflowID": r.WorkflowID,
|
||||
"createdBy": r.CreatedBy,
|
||||
"completed": r.Completed,
|
||||
"status": r.Status,
|
||||
"eventType": r.EventType,
|
||||
"resourceType": r.ResourceType,
|
||||
"limit": r.Limit,
|
||||
"incTotal": r.IncTotal,
|
||||
"pageCursor": r.PageCursor,
|
||||
"sort": r.Sort,
|
||||
}
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetSessionID() []string {
|
||||
return r.SessionID
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetWorkflowID() []string {
|
||||
return r.WorkflowID
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetCreatedBy() []string {
|
||||
return r.CreatedBy
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetCompleted() uint {
|
||||
return r.Completed
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetStatus() []uint {
|
||||
return r.Status
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetEventType() string {
|
||||
return r.EventType
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetResourceType() string {
|
||||
return r.ResourceType
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetLimit() uint {
|
||||
return r.Limit
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetIncTotal() bool {
|
||||
return r.IncTotal
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetPageCursor() string {
|
||||
return r.PageCursor
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionList) GetSort() string {
|
||||
return r.Sort
|
||||
}
|
||||
|
||||
// Fill processes request and fills internal variables
|
||||
func (r *SessionList) Fill(req *http.Request) (err error) {
|
||||
|
||||
{
|
||||
// GET params
|
||||
tmp := req.URL.Query()
|
||||
|
||||
if val, ok := tmp["sessionID[]"]; ok {
|
||||
r.SessionID, err = val, nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if val, ok := tmp["sessionID"]; ok {
|
||||
r.SessionID, err = val, nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["workflowID[]"]; ok {
|
||||
r.WorkflowID, err = val, nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if val, ok := tmp["workflowID"]; ok {
|
||||
r.WorkflowID, err = val, nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["createdBy[]"]; ok {
|
||||
r.CreatedBy, err = val, nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if val, ok := tmp["createdBy"]; ok {
|
||||
r.CreatedBy, err = val, nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["completed"]; ok && len(val) > 0 {
|
||||
r.Completed, err = payload.ParseUint(val[0]), nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["status[]"]; ok {
|
||||
r.Status, err = payload.ParseUints(val), nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if val, ok := tmp["status"]; ok {
|
||||
r.Status, err = payload.ParseUints(val), nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["eventType"]; ok && len(val) > 0 {
|
||||
r.EventType, err = val[0], nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["resourceType"]; ok && len(val) > 0 {
|
||||
r.ResourceType, err = val[0], nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["limit"]; ok && len(val) > 0 {
|
||||
r.Limit, err = payload.ParseUint(val[0]), nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["incTotal"]; ok && len(val) > 0 {
|
||||
r.IncTotal, err = payload.ParseBool(val[0]), nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["pageCursor"]; ok && len(val) > 0 {
|
||||
r.PageCursor, err = val[0], nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := tmp["sort"]; ok && len(val) > 0 {
|
||||
r.Sort, err = val[0], nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// NewSessionRead request
|
||||
func NewSessionRead() *SessionRead {
|
||||
return &SessionRead{}
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionRead) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"sessionID": r.SessionID,
|
||||
}
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionRead) GetSessionID() uint64 {
|
||||
return r.SessionID
|
||||
}
|
||||
|
||||
// Fill processes request and fills internal variables
|
||||
func (r *SessionRead) Fill(req *http.Request) (err error) {
|
||||
|
||||
{
|
||||
var val string
|
||||
// path params
|
||||
|
||||
val = chi.URLParam(req, "sessionID")
|
||||
r.SessionID, err = payload.ParseUint64(val), nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// NewSessionCancel request
|
||||
func NewSessionCancel() *SessionCancel {
|
||||
return &SessionCancel{}
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionCancel) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"sessionID": r.SessionID,
|
||||
}
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionCancel) GetSessionID() uint64 {
|
||||
return r.SessionID
|
||||
}
|
||||
|
||||
// Fill processes request and fills internal variables
|
||||
func (r *SessionCancel) Fill(req *http.Request) (err error) {
|
||||
|
||||
{
|
||||
var val string
|
||||
// path params
|
||||
|
||||
val = chi.URLParam(req, "sessionID")
|
||||
r.SessionID, err = payload.ParseUint64(val), nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// NewSessionListPrompts request
|
||||
func NewSessionListPrompts() *SessionListPrompts {
|
||||
return &SessionListPrompts{}
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionListPrompts) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
|
||||
// Fill processes request and fills internal variables
|
||||
func (r *SessionListPrompts) Fill(req *http.Request) (err error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// NewSessionResumeState request
|
||||
func NewSessionResumeState() *SessionResumeState {
|
||||
return &SessionResumeState{}
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionResumeState) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"sessionID": r.SessionID,
|
||||
"stateID": r.StateID,
|
||||
"input": r.Input,
|
||||
}
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionResumeState) GetSessionID() uint64 {
|
||||
return r.SessionID
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionResumeState) GetStateID() uint64 {
|
||||
return r.StateID
|
||||
}
|
||||
|
||||
// Auditable returns all auditable/loggable parameters
|
||||
func (r SessionResumeState) GetInput() *expr.Vars {
|
||||
return r.Input
|
||||
}
|
||||
|
||||
// Fill processes request and fills internal variables
|
||||
func (r *SessionResumeState) Fill(req *http.Request) (err error) {
|
||||
|
||||
if strings.HasPrefix(strings.ToLower(req.Header.Get("content-type")), "application/json") {
|
||||
err = json.NewDecoder(req.Body).Decode(r)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
err = nil
|
||||
case err != nil:
|
||||
return fmt.Errorf("error parsing http request body: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// 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
|
||||
}
|
||||
|
||||
// POST params
|
||||
|
||||
if val, ok := req.Form["input[]"]; ok {
|
||||
r.Input, err = types.ParseWorkflowVariables(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if val, ok := req.Form["input"]; ok {
|
||||
r.Input, err = types.ParseWorkflowVariables(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var val string
|
||||
// path params
|
||||
|
||||
val = chi.URLParam(req, "sessionID")
|
||||
r.SessionID, err = payload.ParseUint64(val), nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
val = chi.URLParam(req, "stateID")
|
||||
r.StateID, err = payload.ParseUint64(val), nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user