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:
444
server/system/automation/actionlog_handler.gen.go
generated
Normal file
444
server/system/automation/actionlog_handler.gen.go
generated
Normal file
@@ -0,0 +1,444 @@
|
||||
package automation
|
||||
|
||||
// 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:
|
||||
// system/automation/actionlog_handler.yaml
|
||||
|
||||
import (
|
||||
"context"
|
||||
atypes "github.com/cortezaproject/corteza/server/automation/types"
|
||||
"github.com/cortezaproject/corteza/server/pkg/actionlog"
|
||||
"github.com/cortezaproject/corteza/server/pkg/expr"
|
||||
"github.com/cortezaproject/corteza/server/pkg/wfexec"
|
||||
"time"
|
||||
)
|
||||
|
||||
var _ wfexec.ExecResponse
|
||||
|
||||
type (
|
||||
actionlogHandlerRegistry interface {
|
||||
AddFunctions(ff ...*atypes.Function)
|
||||
Type(ref string) expr.Type
|
||||
}
|
||||
)
|
||||
|
||||
func (h actionlogHandler) register() {
|
||||
h.reg.AddFunctions(
|
||||
h.Search(),
|
||||
h.Each(),
|
||||
h.Record(),
|
||||
)
|
||||
}
|
||||
|
||||
type (
|
||||
actionlogSearchArgs struct {
|
||||
hasFromTimestamp bool
|
||||
FromTimestamp *time.Time
|
||||
|
||||
hasToTimestamp bool
|
||||
ToTimestamp *time.Time
|
||||
|
||||
hasBeforeActionID bool
|
||||
BeforeActionID uint64
|
||||
|
||||
hasActorID bool
|
||||
ActorID uint64
|
||||
|
||||
hasOrigin bool
|
||||
Origin string
|
||||
|
||||
hasResource bool
|
||||
Resource string
|
||||
|
||||
hasAction bool
|
||||
Action string
|
||||
|
||||
hasLimit bool
|
||||
Limit uint64
|
||||
}
|
||||
|
||||
actionlogSearchResults struct {
|
||||
Actions []*actionlog.Action
|
||||
}
|
||||
)
|
||||
|
||||
// Search function Action log search
|
||||
//
|
||||
// expects implementation of search function:
|
||||
//
|
||||
// func (h actionlogHandler) search(ctx context.Context, args *actionlogSearchArgs) (results *actionlogSearchResults, err error) {
|
||||
// return
|
||||
// }
|
||||
func (h actionlogHandler) Search() *atypes.Function {
|
||||
return &atypes.Function{
|
||||
Ref: "actionlogSearch",
|
||||
Kind: "function",
|
||||
Labels: map[string]string{"actionlog": "step,workflow"},
|
||||
Meta: &atypes.FunctionMeta{
|
||||
Short: "Action log search",
|
||||
},
|
||||
|
||||
Parameters: []*atypes.Param{
|
||||
{
|
||||
Name: "fromTimestamp",
|
||||
Types: []string{"DateTime"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "From timestamp",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "toTimestamp",
|
||||
Types: []string{"DateTime"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "To timestamp",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "beforeActionID",
|
||||
Types: []string{"ID"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Before action ID",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "actorID",
|
||||
Types: []string{"ID"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Actor ID",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "origin",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Origin",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "resource",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Resource",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "action",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Action",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "limit",
|
||||
Types: []string{"UnsignedInteger"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Limit",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Results: []*atypes.Param{
|
||||
|
||||
{
|
||||
Name: "actions",
|
||||
Types: []string{"Action"},
|
||||
IsArray: true,
|
||||
},
|
||||
},
|
||||
|
||||
Handler: func(ctx context.Context, in *expr.Vars) (out *expr.Vars, err error) {
|
||||
var (
|
||||
args = &actionlogSearchArgs{
|
||||
hasFromTimestamp: in.Has("fromTimestamp"),
|
||||
hasToTimestamp: in.Has("toTimestamp"),
|
||||
hasBeforeActionID: in.Has("beforeActionID"),
|
||||
hasActorID: in.Has("actorID"),
|
||||
hasOrigin: in.Has("origin"),
|
||||
hasResource: in.Has("resource"),
|
||||
hasAction: in.Has("action"),
|
||||
hasLimit: in.Has("limit"),
|
||||
}
|
||||
)
|
||||
|
||||
if err = in.Decode(args); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var results *actionlogSearchResults
|
||||
if results, err = h.search(ctx, args); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
out = &expr.Vars{}
|
||||
|
||||
{
|
||||
// converting results.Actions (*actionlog.Action) to Array (of Action)
|
||||
var (
|
||||
tval expr.TypedValue
|
||||
tarr = make([]expr.TypedValue, len(results.Actions))
|
||||
)
|
||||
|
||||
for i := range results.Actions {
|
||||
if tarr[i], err = h.reg.Type("Action").Cast(results.Actions[i]); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if tval, err = expr.NewArray(tarr); err != nil {
|
||||
return
|
||||
} else if err = expr.Assign(out, "actions", tval); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type (
|
||||
actionlogEachArgs struct {
|
||||
hasFromTimestamp bool
|
||||
FromTimestamp *time.Time
|
||||
|
||||
hasToTimestamp bool
|
||||
ToTimestamp *time.Time
|
||||
|
||||
hasBeforeActionID bool
|
||||
BeforeActionID uint64
|
||||
|
||||
hasActorID bool
|
||||
ActorID uint64
|
||||
|
||||
hasOrigin bool
|
||||
Origin string
|
||||
|
||||
hasResource bool
|
||||
Resource string
|
||||
|
||||
hasAction bool
|
||||
Action string
|
||||
|
||||
hasLimit bool
|
||||
Limit uint64
|
||||
}
|
||||
|
||||
actionlogEachResults struct {
|
||||
Action *actionlog.Action
|
||||
}
|
||||
)
|
||||
|
||||
// Each function Action log
|
||||
//
|
||||
// expects implementation of each function:
|
||||
//
|
||||
// func (h actionlogHandler) each(ctx context.Context, args *actionlogEachArgs) (results *actionlogEachResults, err error) {
|
||||
// return
|
||||
// }
|
||||
func (h actionlogHandler) Each() *atypes.Function {
|
||||
return &atypes.Function{
|
||||
Ref: "actionlogEach",
|
||||
Kind: "iterator",
|
||||
Labels: map[string]string{"actionlog": "step,workflow"},
|
||||
Meta: &atypes.FunctionMeta{
|
||||
Short: "Action log",
|
||||
},
|
||||
|
||||
Parameters: []*atypes.Param{
|
||||
{
|
||||
Name: "fromTimestamp",
|
||||
Types: []string{"DateTime"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "From timestamp",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "toTimestamp",
|
||||
Types: []string{"DateTime"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "To timestamp",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "beforeActionID",
|
||||
Types: []string{"ID"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Before action ID",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "actorID",
|
||||
Types: []string{"ID"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Actor ID",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "origin",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Origin",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "resource",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Resource",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "action",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Action",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "limit",
|
||||
Types: []string{"UnsignedInteger"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Limit",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Results: []*atypes.Param{
|
||||
|
||||
{
|
||||
Name: "action",
|
||||
Types: []string{"Action"},
|
||||
},
|
||||
},
|
||||
|
||||
Iterator: func(ctx context.Context, in *expr.Vars) (out wfexec.IteratorHandler, err error) {
|
||||
var (
|
||||
args = &actionlogEachArgs{
|
||||
hasFromTimestamp: in.Has("fromTimestamp"),
|
||||
hasToTimestamp: in.Has("toTimestamp"),
|
||||
hasBeforeActionID: in.Has("beforeActionID"),
|
||||
hasActorID: in.Has("actorID"),
|
||||
hasOrigin: in.Has("origin"),
|
||||
hasResource: in.Has("resource"),
|
||||
hasAction: in.Has("action"),
|
||||
hasLimit: in.Has("limit"),
|
||||
}
|
||||
)
|
||||
|
||||
if err = in.Decode(args); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return h.each(ctx, args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type (
|
||||
actionlogRecordArgs struct {
|
||||
hasAction bool
|
||||
Action string
|
||||
|
||||
hasResource bool
|
||||
Resource string
|
||||
|
||||
hasError bool
|
||||
Error string
|
||||
|
||||
hasSeverity bool
|
||||
Severity string
|
||||
|
||||
hasDescription bool
|
||||
Description string
|
||||
|
||||
hasMeta bool
|
||||
Meta *expr.Vars
|
||||
}
|
||||
)
|
||||
|
||||
// Record function Record action into action log
|
||||
//
|
||||
// expects implementation of record function:
|
||||
//
|
||||
// func (h actionlogHandler) record(ctx context.Context, args *actionlogRecordArgs) (err error) {
|
||||
// return
|
||||
// }
|
||||
func (h actionlogHandler) Record() *atypes.Function {
|
||||
return &atypes.Function{
|
||||
Ref: "actionlogRecord",
|
||||
Kind: "function",
|
||||
Labels: map[string]string{"actionlog": "step,workflow"},
|
||||
Meta: &atypes.FunctionMeta{
|
||||
Short: "Record action into action log",
|
||||
},
|
||||
|
||||
Parameters: []*atypes.Param{
|
||||
{
|
||||
Name: "action",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Action",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "resource",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Resource",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "error",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Error",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "severity",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Severity",
|
||||
Visual: map[string]interface{}{"options": []interface{}{"emergency", "alert", "critical", "err", "warning", "notice", "info", "debug"}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "description",
|
||||
Types: []string{"String"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Description",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "meta",
|
||||
Types: []string{"Vars"},
|
||||
Meta: &atypes.ParamMeta{
|
||||
Label: "Meta",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Handler: func(ctx context.Context, in *expr.Vars) (out *expr.Vars, err error) {
|
||||
var (
|
||||
args = &actionlogRecordArgs{
|
||||
hasAction: in.Has("action"),
|
||||
hasResource: in.Has("resource"),
|
||||
hasError: in.Has("error"),
|
||||
hasSeverity: in.Has("severity"),
|
||||
hasDescription: in.Has("description"),
|
||||
hasMeta: in.Has("meta"),
|
||||
}
|
||||
)
|
||||
|
||||
if err = in.Decode(args); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return out, h.record(ctx, args)
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user