session

package
v0.18.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 44 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ResourceTypeApp         = "app"
	ResourceTypeQVApp       = "qvapp"
	ResourceTypeGenericLink = "genericlink"
	ResourceTypeDataset     = "dataset"
	ResourceTypeDataAsset   = "dataasset"
)

Currently known resource types

View Source
const (
	EventWsReconnectStarted = "eventws.reconnect.started"
	EventWsReconnectEnded   = "eventws.reconnect.ended"
)

Fake "events" for event websocket

View Source
const (
	TargetEnvQlikSenseOnWindows = "qseow"
	TargetEnvStandaloneEngine   = "engine"

	TargetEnvDefault = TargetEnvStandaloneEngine
)

Standard defined target environments

View Source
const (
	// DefaultTimeout per request timeout
	DefaultTimeout = 300 * time.Second
)
View Source
const (
	GeneratedPropertiesPath = "/qUndoExclude/generated"
)

Variables

View Source
var (
	GlobalObjectHandler objectHandlerMap
)
View Source
var (
	// LogFeatureFlags logs feature flags unless previously logged
	LogFeatureFlags = &sync.Once{}
)

Functions

func CheckResponseStatus

func CheckResponseStatus(request *RestRequest, statusCodes []int) error

CheckResponseStatus validates that a response has acceptable

func DefaultClient

func DefaultClient(allowUntrusted bool, state *State) (*http.Client, error)

DefaultClient creates client instance with default client settings

func DefaultSetObjectDataAndEvents added in v0.17.18

func DefaultSetObjectDataAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, genObj *enigma.GenericObject, def *senseobjdef.ObjectDef)

func EngineCodeToString added in v0.17.19

func EngineCodeToString(errorCode int) string

func GetAndAddObjectAsync added in v0.5.3

func GetAndAddObjectAsync(sessionState *State, actionState *action.State, name string)

GetAndAddObjectAsync get and add object to object handling

func GetAndAddObjectSync added in v0.5.7

func GetAndAddObjectSync(sessionState *State, actionState *action.State, name string)

GetAndAddObjectSync get and add object to object handling

func GetApproriateNrOfBins added in v0.5.3

func GetApproriateNrOfBins(hypercube *enigmahandlers.HyperCube) int

Logic as written in client.js as of sense april 2018:

getApproriateNrOfBins: function (t) {
	var e = t.qHyperCube.qMeasureInfo.length || 1,
	n = 4 + 2 * (e - 1);
	return t.qHyperCube.qDimensionInfo.length > 1 && (e = Math.max(1, Math.min(h.maxNumberOfLines, t.qHyperCube.qDimensionInfo[1].qStateCounts.qLocked + t.qHyperCube.qDimensionInfo[1].qStateCounts.qOption + t.qHyperCube.qDimensionInfo[1].qStateCounts.qSelected)), n = 4),
	Math.ceil(2e3 / (e * n))
},

func GetFullContinuousRange added in v0.5.3

func GetFullContinuousRange(hypercube *enigmahandlers.HyperCube) (enigma.Float64, enigma.Float64, error)

Logic as written in client.js as of sense april 2018:

getFullContinuousRange: function (t) {
	var e = t.qHyperCube.qDimensionInfo[0].qMin,
	n = t.qHyperCube.qDimensionInfo[0].qMax;
	return n < e || "NaN" === n ? e = n = "NaN" : e === n && (e -= .5, n += .5), {
		min: e,
		max: n
	}
},

func GetObjectLayout added in v0.5.3

func GetObjectLayout(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, def *senseobjdef.ObjectDef) error

func GetObjectProperties added in v0.5.3

func GetObjectProperties(sessionState *State, actionState *action.State, obj *enigmahandlers.Object) error

func LogTrafficIn added in v0.11.5

func LogTrafficIn(resp *http.Response, trafficLogger MinimalTrafficLogger, logEntry *logger.LogEntry, requestID uint64)

func LogTrafficOut added in v0.11.5

func LogTrafficOut(req *http.Request, doLogBody bool, trafficLogger MinimalTrafficLogger, logEntry *logger.LogEntry, requestID uint64)

func ReadAll added in v0.6.21

func ReadAll(r io.Reader) ([]byte, error)

func RegisterCustomHeadersFunc added in v0.18.0

func RegisterCustomHeadersFunc(f CustomHeadersFunc) error

RegisterCustomHeadersFunc adds extra headers to all http requests. RegisterCustomHeadersFunc shall be called only once and this call shall be before the gopherciser scenario runs.

func SetChildList added in v0.5.3

func SetChildList(rawLayout json.RawMessage, obj *enigmahandlers.Object) error

func SetChildren added in v0.5.3

func SetChildren(rawLayout json.RawMessage, obj *enigmahandlers.Object) error

func SetHyperCube added in v0.5.3

func SetHyperCube(rawLayout json.RawMessage, obj *enigmahandlers.Object, path helpers.DataPath) error

func SetListObject added in v0.5.3

func SetListObject(rawLayout json.RawMessage, obj *enigmahandlers.Object, path helpers.DataPath) error

func SetObjectData added in v0.5.3

func SetObjectData(sessionState *State, actionState *action.State, rawLayout json.RawMessage, objectDef *senseobjdef.ObjectDef,
	obj *enigmahandlers.Object, enigmaObject *enigma.GenericObject) error

SetObjectData sets data to obj from layout and data requests according to objectDef

func UpdateListObjectDataAsync added in v0.5.3

func UpdateListObjectDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject,
	obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)

UpdateListObjectDataAsync send get listobject data and update saved list object

func UpdateObjectHyperCubeBinnedDataAsync added in v0.5.3

func UpdateObjectHyperCubeBinnedDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject,
	obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)

UpdateObjectHyperCubeBinnedDataAsync send get hypercube binned data request and update saved hypercube

func UpdateObjectHyperCubeContinuousDataAsync added in v0.5.3

func UpdateObjectHyperCubeContinuousDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject,
	obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)

UpdateObjectHyperCubeContinuousDataAsync send get continous data request

func UpdateObjectHyperCubeDataAsync added in v0.5.3

func UpdateObjectHyperCubeDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject,
	obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests, columns bool)

UpdateObjectHyperCubeDataAsync send get straight hypercube data and update saved hypercube

func UpdateObjectHyperCubeReducedDataAsync added in v0.5.3

func UpdateObjectHyperCubeReducedDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject,
	obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)

UpdateObjectHyperCubeReducedDataAsync send get hypercube reduced data request and update saved hypercube

func UpdateObjectHyperCubeStackDataAsync added in v0.5.3

func UpdateObjectHyperCubeStackDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject,
	obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)

UpdateObjectHyperCubeStackDataAsync send get stacked hypercube data and update saved hypercube

func UpdateObjectHyperCubeTreeDataAsync added in v0.6.26

func UpdateObjectHyperCubeTreeDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject,
	obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)

UpdateObjectHyperCubeTreeDataAsync send get hypercube tree data request and update saved data

func WarnOrError

func WarnOrError(actionState *action.State, logEntry *logger.LogEntry, failOnError bool, err error)

WarnOrError add error to action or log warning

Types

type AppSelection

type AppSelection struct {
	AppSelectionCore
	// contains filtered or unexported fields
}

AppSelection contains the selected app for the current session

func NewAppSelection

func NewAppSelection(appMode AppSelectionModeEnum, app string, list []string) (*AppSelection, error)

NewAppSelection creates new instance of AppSelection

func (*AppSelection) Select

func (appSelection *AppSelection) Select(sessionState *State) (*ArtifactEntry, error)

Select new app

func (*AppSelection) UnmarshalJSON

func (appSelection *AppSelection) UnmarshalJSON(arg []byte) error

UnmarshalJSON unmarshal AppSelection

func (*AppSelection) Validate

func (appSelection *AppSelection) Validate() error

Validate AppSelection settings

type AppSelectionCore

type AppSelectionCore struct {
	// AppMode app selection mode
	AppMode AppSelectionModeEnum `json:"appmode" displayname:"App selection mode" doc-key:"appselection.appmode"`
	// App name or GUID depending on AppMode
	App synced.Template `json:"app,omitempty" displayname:"App" doc-key:"appselection.app"`
	// AppList of app names or GUID's, depending on AppMode
	AppList []string `json:"list,omitempty" displayname:"App selection list" doc-key:"appselection.list"`
	// Filename of file containing app names, one app per line
	Filename helpers.RowFile `json:"filename,omitempty" displayname:"App selection filename" displayelement:"file" doc-key:"appselection.filename"`
}

AppSelectionCore app selection settings shared between multiple actions

type AppSelectionModeEnum

type AppSelectionModeEnum int

AppSelectionModeEnum from where to get app to open, defaults to "current"

const (
	AppModeCurrent AppSelectionModeEnum = iota
	AppModeGUID
	AppModeName
	AppModeRandom
	AppModeRandomNameFromList
	AppModeRandomGUIDFromList
	AppModeRandomNameFromFile
	AppModeRandomGUIDFromFile
	AppModeRound
	AppModeRoundNameFromList
	AppModeRoundGUIDFromList
	AppModeRoundNameFromFile
	AppModeRoundGUIDFromFile
)

AppSelectionModeEnum from where to get app to open, defaults to "current"

func (AppSelectionModeEnum) GetEnumMap

func (mode AppSelectionModeEnum) GetEnumMap() *enummap.EnumMap

GetEnumMap for app selection mode

func (AppSelectionModeEnum) MarshalJSON

func (mode AppSelectionModeEnum) MarshalJSON() ([]byte, error)

MarshalJSON marshal AppSelectionModeEnum

func (AppSelectionModeEnum) String

func (mode AppSelectionModeEnum) String() string

String implements stringer interface

func (*AppSelectionModeEnum) UnmarshalJSON

func (mode *AppSelectionModeEnum) UnmarshalJSON(arg []byte) error

UnmarshalJSON unmarshal AppSelectionModeEnum

type ArtifactEntry

type ArtifactEntry struct {
	Name         string      `json:"name"`
	ID           string      `json:"resourceId"`
	ItemID       string      `json:"ID,omitempty"`
	ResourceType string      `json:"resourceType"`
	Data         interface{} `json:"-"`
}

ArtifactEntry is the entry for most, but not all, item types in artifact map

func (*ArtifactEntry) Copy

func (entry *ArtifactEntry) Copy() *ArtifactEntry

Copy of ArtifactEntry

type ArtifactEntryCompareType added in v0.12.0

type ArtifactEntryCompareType int
const (
	ArtifactEntryCompareTypeID ArtifactEntryCompareType = iota
	ArtifactEntryCompareTypeItemID
	ArtifactEntryCompareTypeName
)

func (ArtifactEntryCompareType) String added in v0.17.13

func (cmpType ArtifactEntryCompareType) String() string

type ArtifactKey added in v0.6.19

type ArtifactKey struct {
	Title string
	Type  string
}

ArtifactKey used to find item using title

type ArtifactList added in v0.6.19

type ArtifactList struct {
	// contains filtered or unexported fields
}

ArtifactList all items, spaces and collections

func (*ArtifactList) Len added in v0.6.19

func (d *ArtifactList) Len() int

func (ArtifactList) Less added in v0.6.19

func (d ArtifactList) Less(i, j int) bool

func (ArtifactList) MarshalJSON added in v0.6.19

func (d ArtifactList) MarshalJSON() ([]byte, error)

MarshalJSON marshal artifact list to JSON

func (ArtifactList) Swap added in v0.6.19

func (d ArtifactList) Swap(i, j int)

type ArtifactMap

type ArtifactMap struct {
	NonEphemeralResourceTypes []string
	// contains filtered or unexported fields
}

ArtifactMap is the map between app names and GUIDs

func NewArtifactMap added in v0.6.19

func NewArtifactMap() *ArtifactMap

NewArtifactMap returns an empty ArtifactMap

func (*ArtifactMap) Append added in v0.6.19

func (am *ArtifactMap) Append(resourceType string, entry *ArtifactEntry)

Append locks ArtifactMap and appends entry to artifact list

func (*ArtifactMap) ClearArtifactMap added in v0.6.19

func (am *ArtifactMap) ClearArtifactMap()

ClearArtifactMap Empty Apps from ArtifactMap

func (*ArtifactMap) Count added in v0.6.19

func (am *ArtifactMap) Count(resourceType string) int

Count of specified resource type list

func (*ArtifactMap) DeleteApp

func (am *ArtifactMap) DeleteApp(appGUID string)

DeleteApp deletes an app from the ArtifactMap

func (*ArtifactMap) DeleteItem added in v0.6.19

func (am *ArtifactMap) DeleteItem(resourceType, lookfor string, compareType ArtifactEntryCompareType)

DeleteItem from artifact map

func (*ArtifactMap) DeleteItemUsingID added in v0.6.19

func (am *ArtifactMap) DeleteItemUsingID(id, resourceType string)

DeleteItemUsingID with resource type and ID

func (*ArtifactMap) DeleteItemUsingItemID added in v0.12.0

func (am *ArtifactMap) DeleteItemUsingItemID(id, resourceType string)

DeleteItemUsingItemID with resource type and item ID

func (*ArtifactMap) FillAppsUsingDocListEntries

func (am *ArtifactMap) FillAppsUsingDocListEntries(docListEntries []*enigma.DocListEntry) error

FillAppsUsingDocListEntries should be used to fillAppMap app map in QSEoW

func (*ArtifactMap) FillAppsUsingStream added in v0.10.0

func (am *ArtifactMap) FillAppsUsingStream(stream structs.Stream) error

FillAppsUsingStream

func (*ArtifactMap) FillArtifacts added in v0.6.19

func (am *ArtifactMap) FillArtifacts(item *ItemData) error

FillArtifacts puts the app name (key) and the app ID (value) in the ArtifactMap

func (*ArtifactMap) First added in v0.6.19

func (am *ArtifactMap) First(resourceType string) *ArtifactEntry

First entry of resource type

func (*ArtifactMap) GetAllOfType added in v0.17.9

func (am *ArtifactMap) GetAllOfType(sessionState *State, resourcetype string) []ArtifactEntry

GetAllOfType gets a copy of a list of the current items with specified resource type

func (*ArtifactMap) GetAppID

func (am *ArtifactMap) GetAppID(appName string) (string, error)

GetAppID returns the app ID given the app Title. When multiple apps have the same Title, this will return the ID of the last app in the order of the struct passed to the Fill function.

func (*ArtifactMap) GetAppItemID added in v0.6.19

func (am *ArtifactMap) GetAppItemID(appName string) (string, error)

GetAppItemID returns the item ID given the app Title. When multiple apps have the same Title, this will return the ID of the last app in the order of the struct passed to the Fill function.

func (*ArtifactMap) GetRandomApp

func (am *ArtifactMap) GetRandomApp(sessionState *State) (ArtifactEntry, error)

GetRandomApp returns a random app for the map, chosen by a uniform distribution

func (*ArtifactMap) GetRoundRobin

func (am *ArtifactMap) GetRoundRobin(sessionState *State) (ArtifactEntry, error)

GetRoundRobin returns a app round robin for the map

func (*ArtifactMap) JSON added in v0.6.19

func (am *ArtifactMap) JSON() ([]byte, error)

JSON locks artifact map and marshals json

func (*ArtifactMap) LogMap

func (am *ArtifactMap) LogMap(entry *logger.LogEntry) error

LogMap log entire map as debug logging

func (*ArtifactMap) Lookup added in v0.9.0

func (am *ArtifactMap) Lookup(resourcetype, lookup string, compareType ArtifactEntryCompareType) (*ArtifactEntry, error)

Lookup resource type with using lookup (name or ID, defined by id flag)

func (*ArtifactMap) LookupAppGUID

func (am *ArtifactMap) LookupAppGUID(guid string) (*ArtifactEntry, error)

LookupAppGUID lookup app using GUID

func (*ArtifactMap) LookupAppTitle

func (am *ArtifactMap) LookupAppTitle(title string) (*ArtifactEntry, error)

LookupAppTitle lookup app using title

func (*ArtifactMap) LookupItemID added in v0.12.0

func (am *ArtifactMap) LookupItemID(resourcetype, itemID string) (*ArtifactEntry, error)

LookupItemID lookup resource using Item ID

func (*ArtifactMap) Sort added in v0.6.19

func (am *ArtifactMap) Sort(resourceType string)

Sort entries of resource type

type AutoChartHandler added in v0.5.3

type AutoChartHandler struct {
	DefaultHandler
}

func (*AutoChartHandler) Instance added in v0.5.3

func (handler *AutoChartHandler) Instance(id string) ObjectHandlerInstance

type AutoChartInstance added in v0.5.3

type AutoChartInstance struct {
	DefaultHandlerInstance
	ObjectDef *senseobjdef.ObjectDef
}

func (*AutoChartInstance) GetObjectDefinition added in v0.5.4

func (instance *AutoChartInstance) GetObjectDefinition(objectType string) (string, senseobjdef.SelectType, senseobjdef.DataDefType, error)

func (*AutoChartInstance) SetObjectAndEvents added in v0.5.3

func (instance *AutoChartInstance) SetObjectAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, genObj *enigma.GenericObject)

GetObject implement ObjectHandler interface

func (*AutoChartInstance) SetObjectDefData added in v0.5.4

func (instance *AutoChartInstance) SetObjectDefData(objDefData []senseobjdef.Data)

type CalcEvalConditionFailedError added in v0.14.5

type CalcEvalConditionFailedError string

func (CalcEvalConditionFailedError) Error added in v0.14.5

Error implements error interface

type ConnectionSettings

type ConnectionSettings interface {
	AllowUntrusted() bool
}

ConnectionSettings interface

type ContainerChild added in v0.6.10

type ContainerChild struct {
	RefID             string             `json:"refId"`
	Label             string             `json:"label"`
	IsMaster          bool               `json:"isMaster"`
	ExternalReference *ContainerExternal `json:"externalReference"`
	Type              string             `json:"type"`
	Condition         *helpers.FuzzyBool `json:"condition"`
}

type ContainerChildItem added in v0.6.10

type ContainerChildItem struct {
	Info enigma.NxInfo          `json:"qInfo"`
	Meta interface{}            `json:"qMeta"`
	Data ContainerChildItemData `json:"qData"`
}

type ContainerChildItemData added in v0.6.10

type ContainerChildItemData struct {
	Title            string `json:"title"`
	Visualization    string `json:"visualization"`
	ContainerChildId string `json:"containerChildId"`
	ExtendsId        string `json:"qExtendsId"`
	ShowCondition    string `json:"showCondition"`
}

type ContainerChildList added in v0.6.10

type ContainerChildList struct {
	Items []ContainerChildItem `json:"qItems"`
}

type ContainerChildReference added in v0.6.10

type ContainerChildReference struct {
	RefID    string
	ObjID    string
	External bool
	Show     bool
}

type ContainerExternal added in v0.6.10

type ContainerExternal struct {
	MasterID string `json:"masterId"`
	App      string `json:"app"`
	ViewID   string `json:"viewId"`
}

type ContainerHandler added in v0.6.10

type ContainerHandler struct{}

func (*ContainerHandler) Instance added in v0.6.10

func (handler *ContainerHandler) Instance(id string) ObjectHandlerInstance

Instance implements ObjectHandler interface

type ContainerHandlerInstance added in v0.6.10

type ContainerHandlerInstance struct {
	ID        string
	ActiveID  string
	DefaultID string
	// contains filtered or unexported fields
}

func (*ContainerHandlerInstance) ActiveChildReference added in v0.6.17

func (handler *ContainerHandlerInstance) ActiveChildReference() *ContainerChildReference

ActiveChildReference returns reference to currently active child or nil

func (*ContainerHandlerInstance) ChildWithID added in v0.6.17

func (handler *ContainerHandlerInstance) ChildWithID(id string) *ContainerChildReference

ChildWithID returns child reference to child with defined object ID

func (*ContainerHandlerInstance) Children added in v0.6.10

func (handler *ContainerHandlerInstance) Children() []ContainerChildReference

Children returns copy of children

func (*ContainerHandlerInstance) FirstShowableChild added in v0.6.17

func (handler *ContainerHandlerInstance) FirstShowableChild() (*ContainerChildReference, bool)

FirstShowableChild gets reference to first object from container which fulfills conditions, true if already active object

func (*ContainerHandlerInstance) GetObjectDefinition added in v0.6.10

func (handler *ContainerHandlerInstance) GetObjectDefinition(objectType string) (string, senseobjdef.SelectType, senseobjdef.DataDefType, error)

GetObjectDefinition implements ObjectHandlerInstance interface

func (*ContainerHandlerInstance) SetObjectAndEvents added in v0.6.10

func (handler *ContainerHandlerInstance) SetObjectAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, genObj *enigma.GenericObject)

SetObjectAndEvents implements ObjectHandlerInstance interface

func (*ContainerHandlerInstance) SwitchActiveChild added in v0.6.17

func (handler *ContainerHandlerInstance) SwitchActiveChild(sessionState *State, actionState *action.State, child *ContainerChildReference) error

SwitchActiveChild to referenced child

func (*ContainerHandlerInstance) UpdateChildren added in v0.6.17

func (handler *ContainerHandlerInstance) UpdateChildren(layout *ContainerLayout) error

UpdateChildren of the container

type ContainerLayout added in v0.6.10

type ContainerLayout struct {
	Children   []ContainerChild   `json:"children"`
	ChildList  ContainerChildList `json:"qChildList"`
	DefaultTab string             `json:"defaultTab"`
}

func GetContainerLayout added in v0.6.17

func GetContainerLayout(sessionState *State, actionState *action.State, containerObject *enigma.GenericObject) *ContainerLayout

GetContainerLayout returns unmarshaled container layout, errors reported on action state

type CustomHeadersFunc added in v0.18.0

type CustomHeadersFunc func(input CustomHeadersInput, setHeader func(key, value string))

type CustomHeadersInput added in v0.18.0

type CustomHeadersInput struct {
	// RunID is a string unique to an execution of gopherciser
	RunID              string
	GopherciserVersion string
	Session            logger.SessionEntry
	Action             logger.ActionEntry
}

type DefaultHandler added in v0.5.3

type DefaultHandler struct{}

func (*DefaultHandler) Instance added in v0.5.3

func (handler *DefaultHandler) Instance(id string) ObjectHandlerInstance

type DefaultHandlerInstance added in v0.5.3

type DefaultHandlerInstance struct {
	Id string
}

func (*DefaultHandlerInstance) GetObjectDefinition added in v0.5.3

func (instance *DefaultHandlerInstance) GetObjectDefinition(objectType string) (string, senseobjdef.SelectType, senseobjdef.DataDefType, error)

func (*DefaultHandlerInstance) SetObjectAndEvents added in v0.5.3

func (instance *DefaultHandlerInstance) SetObjectAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, genObj *enigma.GenericObject)

GetObject implement ObjectHandler interface

type DefaultRandomizer added in v0.4.11

type DefaultRandomizer struct {
	*randomizer.Randomizer
	// contains filtered or unexported fields
}

func (*DefaultRandomizer) Reset added in v0.4.11

func (rnd *DefaultRandomizer) Reset(instance, session uint64, onlyInstanceSeed bool)

Reset child randomizer with new seed

type DuplicateKeyError

type DuplicateKeyError string

DuplicateKeyError is returned in case of adding an already existing key id

func (DuplicateKeyError) Error

func (err DuplicateKeyError) Error() string

Error id already exist in map

type Event

type Event struct {
	// F is function to be executed on event
	F func(ctx context.Context, actionState *action.State) error
	// NoFailOnError -
	// False (Default) - Report error and abort action
	// True - Log warning instead of failing and error reporting
	NoFailOnError bool
	// Close executed on de-registering event
	Close func()
}

Event encapsulates an event channel and a function to be executed on events

type EventMetricsLogger added in v0.6.0

type EventMetricsLogger struct {
	LogEntry *logger.LogEntry
}

func (*EventMetricsLogger) SocketOpenMetric added in v0.6.0

func (lgr *EventMetricsLogger) SocketOpenMetric(url *neturl.URL, duration time.Duration)

type FeatureAllocationError added in v0.6.23

type FeatureAllocationError struct{}

FeatureAllocationError returned when feature map is expected to be allocated but is not

func (FeatureAllocationError) Error added in v0.6.23

func (err FeatureAllocationError) Error() string

type FeatureFlagNotFoundError added in v0.6.23

type FeatureFlagNotFoundError string

FeatureFlagNotFoundError returned when feature flag was not found

func (FeatureFlagNotFoundError) Error added in v0.6.23

func (err FeatureFlagNotFoundError) Error() string

type Features added in v0.6.23

type Features struct {
	// contains filtered or unexported fields
}

Features maps feature flags and values

func (*Features) IsFeatureEnabled added in v0.6.23

func (features *Features) IsFeatureEnabled(feature string) (bool, error)

IsFeatureEnabled check if feature flag is enabled

func (*Features) IsFeatureEnabledDefault added in v0.6.23

func (features *Features) IsFeatureEnabledDefault(feature string, d bool) bool

IsFeatureEnabledDefault check if feature flag is enabled, if not existing return default value

func (*Features) UpdateCapabilities added in v0.10.0

func (features *Features) UpdateCapabilities(rest *RestHandler, host string, actionState *action.State, logEntry *logger.LogEntry)

UpdateCapabilities request capabilities from server and updates feature map

func (*Features) UpdateFeatureMap added in v0.6.23

func (features *Features) UpdateFeatureMap(rest *RestHandler, host string, actionState *action.State, logEntry *logger.LogEntry)

UpdateFeatureMap request features from server and updates feature map

type GenericObjectLayoutWithVisualization added in v0.17.18

type GenericObjectLayoutWithVisualization struct {
	enigma.GenericObjectLayout
	Visualization string
}

func GetMasterObjectLayout added in v0.17.18

func GetMasterObjectLayout(sessionState *State, actionState *action.State, containerObject *enigma.GenericObject) *GenericObjectLayoutWithVisualization

GetMasterObjectLayout returns

type HeaderJar

type HeaderJar struct {
	// contains filtered or unexported fields
}

HeaderJar map between hosts and headers

func NewHeaderJar

func NewHeaderJar() *HeaderJar

NewHeaderJar returns an empty HeaderJar

func (*HeaderJar) GetHeader

func (hj *HeaderJar) GetHeader(host string) http.Header

GetHeader returns the header for the given host

func (*HeaderJar) SetHeader

func (hj *HeaderJar) SetHeader(host string, header http.Header)

SetHeader set header for a particular host

type HyperCubeSection added in v0.17.22

type HyperCubeSection int
const (
	HyperCubeSectionRoot HyperCubeSection = iota
	HyperCubeSectionMeasure
	HyperCubeSectionDimension
	HyperCubeSectionMeasureMinichart
)

type IConnection

type IConnection interface {
	// Disconnect connection
	Disconnect() error

	// SetSense : set current sense environment
	SetSense(*enigmahandlers.SenseUplink)
	// Sense : connection to sense environment
	Sense() *enigmahandlers.SenseUplink
}

IConnection interface for current

type IDMap

type IDMap struct {
	// contains filtered or unexported fields
}

IDMap should be used as a lookup table for Id defined in the script and id of object created. We should never define the id to be sent to engine as this might cause collision errors, instead this lookup table is used with the key id connecting object together for in-script purposes.

func (*IDMap) Add

func (idm *IDMap) Add(key, id string, logEntry *logger.LogEntry) error

Add new key to id map

func (*IDMap) Get

func (idm *IDMap) Get(key string) string

Get Id value for key, if key not found return key itself

func (*IDMap) IsDuplicateKey

func (idm *IDMap) IsDuplicateKey(key string) error

IsDuplicateKey returns already in case of duplicate key

func (*IDMap) Replace added in v0.17.24

func (idm *IDMap) Replace(key, id string, logEntry *logger.LogEntry) error

Replace key in id map

type ItemData added in v0.6.19

type ItemData struct {
	Data []ArtifactEntry `json:"data"`
}

ItemData struct to unmarshal list app response

type LayoutContainerChildItem added in v0.17.18

type LayoutContainerChildItem struct {
	Info enigma.NxInfo                `json:"qInfo"`
	Meta interface{}                  `json:"qMeta"`
	Data LayoutContainerChildItemData `json:"qData"`
}

type LayoutContainerChildItemData added in v0.17.18

type LayoutContainerChildItemData struct {
	Title         string `json:"title"`
	Visualization string `json:"visualization"`
	ChildRefId    string `json:"childRefId"`
	ExtendsId     string `json:"qExtendsId"`
}

type LayoutContainerChildList added in v0.17.18

type LayoutContainerChildList struct {
	Items []LayoutContainerChildItem `json:"qItems"`
}

type LayoutContainerHandler added in v0.17.18

type LayoutContainerHandler struct{}

func (*LayoutContainerHandler) Instance added in v0.17.18

func (handler *LayoutContainerHandler) Instance(id string) ObjectHandlerInstance

Instance implements ObjectHandler interface

type LayoutContainerHandlerInstance added in v0.17.18

type LayoutContainerHandlerInstance struct {
	ID string
	// contains filtered or unexported fields
}

func (*LayoutContainerHandlerInstance) GetObjectDefinition added in v0.17.18

func (handler *LayoutContainerHandlerInstance) GetObjectDefinition(objectType string) (string, senseobjdef.SelectType, senseobjdef.DataDefType, error)

GetObjectDefinition implements ObjectHandlerInstance interface

func (*LayoutContainerHandlerInstance) SetObjectAndEvents added in v0.17.18

func (handler *LayoutContainerHandlerInstance) SetObjectAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, genObj *enigma.GenericObject)

SetObjectAndEvents implements ObjectHandlerInstance interface

func (*LayoutContainerHandlerInstance) UpdateChildren added in v0.17.18

func (handler *LayoutContainerHandlerInstance) UpdateChildren(sessionState *State, actionState *action.State, layout *LayoutContainerLayout) error

UpdateChildren of the container

type LayoutContainerLayout added in v0.17.18

type LayoutContainerLayout struct {
	Objects   []LayoutContainerLayoutObject `json:"objects"`
	ChildList LayoutContainerChildList      `json:"qChildList"`
}

func GetLayourContainerLayout added in v0.17.18

func GetLayourContainerLayout(sessionState *State, actionState *action.State, containerObject *enigma.GenericObject) *LayoutContainerLayout

GetLayourContainerLayout returns unmarshaled sn-layout-container layout, errors reported on action state

func (*LayoutContainerLayout) ChildRefsToIDs added in v0.17.18

func (layout *LayoutContainerLayout) ChildRefsToIDs(sessionState *State, childRefs []string) ([]string, error)

ChildRefsToIDs translates a list of child refs to object ID's

type LayoutContainerLayoutObject added in v0.17.18

type LayoutContainerLayoutObject struct {
	ChildRefId string             `json:"childRefId"`
	Condition  *helpers.FuzzyBool `json:"condition"`
}

type MasterObjectHandler added in v0.17.18

type MasterObjectHandler struct{}

func (*MasterObjectHandler) Instance added in v0.17.18

func (handler *MasterObjectHandler) Instance(id string) ObjectHandlerInstance

Instance implements ObjectHandler interface

type MasterObjectHandlerInstance added in v0.17.18

type MasterObjectHandlerInstance struct {
	ID            string
	Visualization string
}

func (*MasterObjectHandlerInstance) GetObjectDefinition added in v0.17.18

func (handler *MasterObjectHandlerInstance) GetObjectDefinition(objectType string) (string, senseobjdef.SelectType, senseobjdef.DataDefType, error)

GetObjectDefinition implements ObjectHandlerInstance interface

func (*MasterObjectHandlerInstance) SetObjectAndEvents added in v0.17.18

func (handler *MasterObjectHandlerInstance) SetObjectAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, genObj *enigma.GenericObject)

SetObjectAndEvents

type MinimalTrafficLogger added in v0.11.5

type MinimalTrafficLogger interface {
	Sent(message []byte)
	Received(message []byte)
}

type NoActiveDocError added in v0.5.7

type NoActiveDocError struct {
	Msg string
	Err error
}

func (NoActiveDocError) Error added in v0.5.7

func (err NoActiveDocError) Error() string

Error implements error interface

type NxValidationError added in v0.17.8

type NxValidationError struct {
	Err     enigma.NxValidationError
	Id      string
	Path    string
	Section HyperCubeSection
}

func (NxValidationError) Code added in v0.17.22

func (err NxValidationError) Code() int

Implements engima.Error interface

func (NxValidationError) Error added in v0.17.8

func (err NxValidationError) Error() string

func (NxValidationError) Message added in v0.17.22

func (err NxValidationError) Message() string

Implements engima.Error interface

func (NxValidationError) Parameter added in v0.17.22

func (err NxValidationError) Parameter() string

Implements engima.Error interface

type ObjectHandler added in v0.5.3

type ObjectHandler interface {
	Instance(id string) ObjectHandlerInstance
}

type ObjectHandlerInstance added in v0.5.3

type ObjectHandlerInstance interface {
	SetObjectAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, genObj *enigma.GenericObject)
	GetObjectDefinition(objectType string) (string, senseobjdef.SelectType, senseobjdef.DataDefType, error)
}

type ReconnectInfo added in v0.5.7

type ReconnectInfo struct {
	// contains filtered or unexported fields
}

type ReconnectSettings added in v0.5.7

type ReconnectSettings struct {
	// Reconnect set to true to attempt reconnecting websocket on disconnect
	Reconnect bool `json:"reconnect" doc-key:"reconnectsettings.reconnect" displayname:"Reconnect on disconnected websocket"`
	// Backoff pattern for reconnect, if empty defaults to defaultReconnectBackoff
	Backoff []float64 `json:"backoff" doc-key:"reconnectsettings.backoff" displayname:"Reconnect backoff pattern"`
}

ReconnectSettings settings for re-connecting websocket on unexpected disconnect

type ReqOptions

type ReqOptions struct {
	// ExpectedStatusCode of response, empty list accepts everything (used e.g. for separate checking status)
	ExpectedStatusCode []int
	// FailOnError set to true for request to add an error to actionState, otherwise a warning is logged.
	FailOnError bool
	// ContentType defaults to application/json
	ContentType string
	// NoVirtualProxy disables the automatic adding of virtualproxy to request when a virtualproxy is defined.
	// This is useful e.g. when sending requests towards non sense environments as part of custom actions.
	NoVirtualProxy bool
}

ReqOptions options controlling handling of requests

func DefaultReqOptions

func DefaultReqOptions() *ReqOptions

DefaultReqOptions sets expected status code to 200 and fails on error

type RestHandler

type RestHandler struct {
	Client *http.Client
	// contains filtered or unexported fields
}

RestHandler handles waiting for pending requests and responses

func NewRestHandler

func NewRestHandler(ctx context.Context, trafficLogger enigma.TrafficLogger, headerjar *HeaderJar, virtualProxy string, timeout time.Duration) *RestHandler

NewRestHandler new instance of RestHandler

func (*RestHandler) DecPending

func (handler *RestHandler) DecPending(request *RestRequest)

DecPending increase finished requests

func (*RestHandler) DeleteAsync added in v0.7.0

func (handler *RestHandler) DeleteAsync(url string, actionState *action.State, logEntry *logger.LogEntry, options *ReqOptions) *RestRequest

DeleteAsync send async DELETE request with options, using options=nil default options are used

func (*RestHandler) DeleteAsyncWithCallback added in v0.7.0

func (handler *RestHandler) DeleteAsyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, headers map[string]string, options *ReqOptions, callback func(err error, req *RestRequest)) *RestRequest

DeleteAsyncWithCallback send async DELETE request with options and callback, using options=nil default options are used

func (*RestHandler) DeleteAsyncWithHeaders added in v0.7.0

func (handler *RestHandler) DeleteAsyncWithHeaders(url string, actionState *action.State, logEntry *logger.LogEntry, headers map[string]string, options *ReqOptions) *RestRequest

DeleteAsyncWithHeaders send async DELETE request with options and headers, using options=nil default options are used

func (*RestHandler) GetAsync

func (handler *RestHandler) GetAsync(url string, actionState *action.State, logEntry *logger.LogEntry, options *ReqOptions) *RestRequest

GetAsync send async GET request with options, using options=nil default options are used

func (*RestHandler) GetAsyncOnce added in v0.15.1

func (handler *RestHandler) GetAsyncOnce(url string, actionState *action.State, sessionState *State, logEntry *logger.LogEntry, options *ReqOptions, uniqueString string) *RestRequest

GetAsyncOnce same as GetAsync but only called once in the same session

func (*RestHandler) GetAsyncWithCallback

func (handler *RestHandler) GetAsyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, options *ReqOptions, callback func(err error, req *RestRequest)) *RestRequest

GetAsyncWithCallback send async GET request with options and callback, with options=nil default options are used

func (*RestHandler) GetSync

func (handler *RestHandler) GetSync(url string, actionState *action.State, logEntry *logger.LogEntry, options *ReqOptions) (*RestRequest, error)

GetSync sends synchronous GET request with options, using options=nil default options are used

func (*RestHandler) GetSyncOnce added in v0.15.1

func (handler *RestHandler) GetSyncOnce(url string, actionState *action.State, sessionState *State, logEntry *logger.LogEntry, options *ReqOptions, uniqueString string) (*RestRequest, error)

GetSyncOnce same as GetSync but only called once in the same session

func (*RestHandler) GetSyncWithCallback

func (handler *RestHandler) GetSyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, options *ReqOptions, callback func(err error, req *RestRequest)) (*RestRequest, error)

GetSyncWithCallback sends synchronous GET request with options and callback, using options=nil default options are used

func (*RestHandler) GetWithHeadersAsync added in v0.5.8

func (handler *RestHandler) GetWithHeadersAsync(url string, actionState *action.State, logEntry *logger.LogEntry, headers map[string]string, options *ReqOptions, callback func(err error, req *RestRequest)) *RestRequest

GetWithHeadersAsync send async GET request with headers and options, using options=nil default options are used

func (*RestHandler) HeadAsync added in v0.17.0

func (handler *RestHandler) HeadAsync(url string, actionState *action.State, logEntry *logger.LogEntry, options *ReqOptions) *RestRequest

HeadAsync send async HEAD request with options, using options=nil default options are used

func (*RestHandler) HeadAsyncWithCallback added in v0.17.0

func (handler *RestHandler) HeadAsyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, options *ReqOptions, callback func(err error, req *RestRequest)) *RestRequest

HeadAsyncWithCallback send async HEAD request with options and callback, with options=nil default options are used

func (*RestHandler) HeadSync added in v0.17.0

func (handler *RestHandler) HeadSync(url string, actionState *action.State, logEntry *logger.LogEntry, options *ReqOptions) (*RestRequest, error)

HeadSync sends synchronous HEAD request with options, using options=nil default options are used

func (*RestHandler) HeadSyncWithCallback added in v0.17.0

func (handler *RestHandler) HeadSyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, options *ReqOptions, callback func(err error, req *RestRequest)) (*RestRequest, error)

HeadSyncWithCallback sends synchronous HEAD request with options and callback, using options=nil default options are used

func (*RestHandler) HeadWithHeadersAsync added in v0.17.0

func (handler *RestHandler) HeadWithHeadersAsync(url string, actionState *action.State, logEntry *logger.LogEntry, headers map[string]string, options *ReqOptions, callback func(err error, req *RestRequest)) *RestRequest

HeadWithHeadersAsync send async HEAD request with headers and options, using options=nil default options are used

func (*RestHandler) IncPending

func (handler *RestHandler) IncPending()

IncPending increase pending requests

func (*RestHandler) PatchAsync added in v0.6.26

func (handler *RestHandler) PatchAsync(url string, actionState *action.State, logEntry *logger.LogEntry, content []byte, options *ReqOptions) *RestRequest

PatchAsync send async PATCH request with options, using options=nil default options are used

func (*RestHandler) PatchAsyncWithCallback added in v0.6.26

func (handler *RestHandler) PatchAsyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, content []byte, headers map[string]string, options *ReqOptions, callback func(err error, req *RestRequest)) *RestRequest

PatchAsyncWithCallback send async PATCH request with options and callback, using options=nil default options are used

func (*RestHandler) PatchWithHeadersAsync added in v0.6.26

func (handler *RestHandler) PatchWithHeadersAsync(url string, actionState *action.State, logEntry *logger.LogEntry, content []byte, headers map[string]string, options *ReqOptions) *RestRequest

PatchWithHeadersAsync send async PATCH request with options and headers, using options=nil default options are used

func (*RestHandler) PostAsync

func (handler *RestHandler) PostAsync(url string, actionState *action.State, logEntry *logger.LogEntry, content []byte, options *ReqOptions) *RestRequest

PostAsync send async POST request with options, using options=nil default options are used

func (*RestHandler) PostAsyncWithCallback

func (handler *RestHandler) PostAsyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, content []byte, headers map[string]string, options *ReqOptions, callback func(err error, req *RestRequest)) *RestRequest

PostAsyncWithCallback send async POST request with options and callback, using options=nil default options are used

func (*RestHandler) PostWithHeadersAsync added in v0.5.8

func (handler *RestHandler) PostWithHeadersAsync(url string, actionState *action.State, logEntry *logger.LogEntry, content []byte, headers map[string]string, options *ReqOptions) *RestRequest

PostWithHeadersAsync send async POST request with options and headers, using options=nil default options are used

func (*RestHandler) PutAsync added in v0.6.26

func (handler *RestHandler) PutAsync(url string, actionState *action.State, logEntry *logger.LogEntry, content []byte, options *ReqOptions) *RestRequest

PutAsync send async PUT request with options, using options=nil default options are used

func (*RestHandler) PutAsyncWithCallback added in v0.6.26

func (handler *RestHandler) PutAsyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, content []byte, headers map[string]string, options *ReqOptions, callback func(err error, req *RestRequest)) *RestRequest

PutAsyncWithCallback send async PUT request with options and callback, using options=nil default options are used

func (*RestHandler) PutWithHeadersAsync added in v0.6.26

func (handler *RestHandler) PutWithHeadersAsync(url string, actionState *action.State, logEntry *logger.LogEntry, content []byte, headers map[string]string, options *ReqOptions) *RestRequest

PutWithHeadersAsync send async PUT request with options and headers, using options=nil default options are used

func (*RestHandler) QueueRequest

func (handler *RestHandler) QueueRequest(actionState *action.State, failOnError bool,
	request *RestRequest, logEntry *logger.LogEntry)

QueueRequest Async request

func (*RestHandler) QueueRequestWithCallback

func (handler *RestHandler) QueueRequestWithCallback(actionState *action.State, failOnError bool,
	request *RestRequest, logEntry *logger.LogEntry, callback func(err error, req *RestRequest))

QueueRequestWithCallback Async request with callback, set warnOnError to log warning instead of registering error for request

func (*RestHandler) SetClient

func (handler *RestHandler) SetClient(client *http.Client)

SetClient set HTTP client for this RestHandler

func (*RestHandler) WaitForPending

func (handler *RestHandler) WaitForPending()

WaitForPending uses double locking of mutex to wait until mutex is unlocked by loop listening for pending req/resp

type RestMethod

type RestMethod int

RestMethod method with which to execute request

const (
	// GET RestMethod
	GET RestMethod = iota
	// POST RestMethod
	POST
	// DELETE RestMethod
	DELETE
	// PUT RestMethod
	PUT
	// PATCH RestMethod
	PATCH
	// HEAD RestMethod
	HEAD
)

RestMethod values

func (RestMethod) MarshalJSON

func (method RestMethod) MarshalJSON() ([]byte, error)

MarshalJSON marshal RestMethod

func (RestMethod) String

func (method RestMethod) String() string

String implements fmt.Stringer interface

func (*RestMethod) UnmarshalJSON

func (method *RestMethod) UnmarshalJSON(arg []byte) error

UnmarshalJSON unmarshal RestMethod

type RestRequest

type RestRequest struct {
	Method        RestMethod
	ContentType   string
	Content       []byte
	ContentReader io.Reader
	Destination   string

	ResponseBody       []byte
	ResponseStatus     string
	ResponseStatusCode int
	ResponseHeaders    http.Header
	ExtraHeaders       map[string]string
	NoVirtualProxy     bool
	// contains filtered or unexported fields
}

RestRequest represents a REST request and its response

type SessionVariableTypeEnum added in v0.11.0

type SessionVariableTypeEnum int
const (
	SessionVariableTypeUnknown SessionVariableTypeEnum = iota
	SessionVariableTypeString
	SessionVariableTypeInt
	SessionVariableTypeArray
)

SessionVariableTypeEnum enumerations

func (SessionVariableTypeEnum) GetEnumMap added in v0.11.0

func (typ SessionVariableTypeEnum) GetEnumMap() *enummap.EnumMap

GetEnumMap return sessionVariableTypeEnumMap to GUI

func (SessionVariableTypeEnum) MarshalJSON added in v0.11.0

func (typ SessionVariableTypeEnum) MarshalJSON() ([]byte, error)

MarshalJSON SessionVariableTypeEnum type

func (SessionVariableTypeEnum) String added in v0.11.0

func (typ SessionVariableTypeEnum) String() string

String implements Stringer interface

func (*SessionVariableTypeEnum) UnmarshalJSON added in v0.11.0

func (typ *SessionVariableTypeEnum) UnmarshalJSON(arg []byte) error

UnmarshalJSON SessionVariableTypeEnum type

func (*SessionVariableTypeEnum) Validate added in v0.11.1

func (typ *SessionVariableTypeEnum) Validate() error

Validate SessionVariableTypeEnum type

type SessionVariables

type SessionVariables struct {
	users.User
	Session    uint64
	Thread     uint64
	ScriptVars map[string]interface{}
	Local      interface{}
	Artifacts  *TemplateArtifactMap
}

SessionVariables is used as a data carrier for session variables.

type State

type State struct {
	Cookies      http.CookieJar
	VirtualProxy string
	Connection   IConnection
	ArtifactMap  *ArtifactMap
	IDMap        IDMap
	HeaderJar    *HeaderJar
	Timeout      time.Duration
	User         *users.User
	OutputsDir   string
	CurrentApp   *ArtifactEntry
	CurrentUser  *structs.User
	Counters     *statistics.ExecutionCounters
	// CurrentActionState will contain the state of the latest action to be started
	CurrentActionState *action.State
	LogEntry           *logger.LogEntry
	EW                 statistics.ErrWarn
	Pending            pending.Handler
	Rest               *RestHandler
	RequestMetrics     *requestmetrics.RequestMetrics
	ReconnectSettings  ReconnectSettings
	Features           Features
	// contains filtered or unexported fields
}

State for user

func New

func New(ctx context.Context, outputsDir string, timeout time.Duration, user *users.User, session, instance uint64,
	virtualProxy string, onlyInstanceSeed bool, counters *statistics.ExecutionCounters) *State

New instance of session state

func NewWithRandomizer added in v0.4.11

func NewWithRandomizer(ctx context.Context, outputsDir string, timeout time.Duration, user *users.User, virtualProxy string,
	rnd helpers.Randomizer, counters *statistics.ExecutionCounters) *State

NewWithRandomizer instance of session state with custom randomizer

func (*State) AddCustomState added in v0.9.0

func (state *State) AddCustomState(key string, value interface{})

AddCustomState add custom data handler to state object

func (*State) AwaitReconnect added in v0.5.7

func (state *State) AwaitReconnect()

AwaitReconnect awaits any reconnect lock to be released

func (*State) BaseContext

func (state *State) BaseContext() context.Context

BaseContext for state. Normally shouldn't be used. Use ReqContext for for context on Sense actions, or methods handling the context such as QueueRequest and SendRequest

func (*State) Cancel

func (state *State) Cancel()

Cancel state context

func (*State) ClearObjectSubscriptions added in v0.6.10

func (state *State) ClearObjectSubscriptions()

ClearObjectSubscriptions and currently subscribed objects

func (*State) ClearSubscribedObjects added in v0.6.10

func (state *State) ClearSubscribedObjects(IDs []string) error

ClearSubscribedObjects unsubscribes from listed objects

func (*State) ContextChangeList

func (state *State) ContextChangeList() (context.Context, *enigma.ChangeLists)

ContextChangeList create changeList object and context to be used for synchronizing changes

func (*State) ContextWithTimeout

func (state *State) ContextWithTimeout(ctx context.Context) (context.Context, context.CancelFunc)

ContextWithTimeout new context based on ctx with default timeout

func (*State) CurrentSenseApp added in v0.5.7

func (state *State) CurrentSenseApp() (*senseobjects.App, error)

CurrentSenseApp returns currently set sense app or error if none found

func (state *State) CurrentSenseUplink() (*enigmahandlers.SenseUplink, error)

CurrentSenseUplink return currently set sense uplink or error if none found

func (*State) DeRegisterEvent

func (state *State) DeRegisterEvent(handle int)

DeRegisterEvent for handle

func (*State) DeRegisterEvents

func (state *State) DeRegisterEvents(handles []int)

DeRegisterEvents for handles in list

func (*State) DeregisterAllEvents

func (state *State) DeregisterAllEvents()

DeregisterAllEvents for session

func (*State) Disconnect

func (state *State) Disconnect()

Disconnect de-registers all events and disconnects current connection

func (*State) EventWebsocket added in v0.6.0

func (state *State) EventWebsocket() *eventws.EventWebsocket

EventWebsocket returns current established event websocket or nil

func (*State) GetCustomState added in v0.9.0

func (state *State) GetCustomState(key string) (interface{}, bool)

GetCustomState data handler from state object

func (*State) GetEventFunc added in v0.17.10

func (state *State) GetEventFunc(handle int) func(ctx context.Context, actionState *action.State) error

GetEvent for handle

func (*State) GetObjectHandlerInstance added in v0.5.3

func (state *State) GetObjectHandlerInstance(id, typ string) ObjectHandlerInstance

GetObjectHandlerInstance for object ID and type

func (*State) GetReconnectError added in v0.5.7

func (state *State) GetReconnectError() error

GetReconnectError from latest finished reconnect attempt

func (*State) GetSessionVariable

func (state *State) GetSessionVariable(localData interface{}) SessionVariables

GetSessionVariable populates and returns session variables struct

func (*State) GetSheet added in v0.5.7

func (state *State) GetSheet(actionState *action.State, upLink *enigmahandlers.SenseUplink, id string) (*enigmahandlers.Object, *senseobjects.Sheet, error)

GetSheet get sheet and add to object list

func (*State) GetSheetList added in v0.5.7

func (state *State) GetSheetList(actionState *action.State, uplink *enigmahandlers.SenseUplink)

GetSheetList create and update sheetlist session object if not existing

func (*State) IsAbortTriggered

func (state *State) IsAbortTriggered() bool

IsAbortTriggered check if abort has been flagged

func (*State) IsSenseWebsocketDisconnected added in v0.6.0

func (state *State) IsSenseWebsocketDisconnected(err error) bool

IsSenseWebsocketDisconnected checks if error is caused by websocket disconnect

func (*State) LogDebugf added in v0.14.11

func (state *State) LogDebugf(format string, args ...interface{})

LogDebugf debug log using current LogEntry

func (*State) LogDetail added in v0.14.11

func (state *State) LogDetail(level logger.LogLevel, msg, detail string)

LogDetail detail entry using current LogEntry

func (*State) LogError added in v0.14.11

func (state *State) LogError(err error)

LogError error log using current LogEntry (remember normaly errors should be added to actionstate if available)

func (*State) LogInfo added in v0.14.11

func (state *State) LogInfo(infoType, msg string)

LogInfo info log using current LogEntry

func (*State) LogTrafficMetric added in v0.14.11

func (state *State) LogTrafficMetric(responseTime int64, sent, received uint64, requestID int, method, params, trafficType, msg string)

LogTrafficMetric traffic metric log using current LogEntry

func (*State) Once added in v0.15.1

func (state *State) Once(key string, f func()) bool

Once executes the function with matching string once (per session)

func (*State) QueueRequest

func (state *State) QueueRequest(f func(ctx context.Context) error, actionState *action.State, failOnError bool, errMsg string)

QueueRequest Async request, add error to action state or log as warning depending on failOnError flag. This method adds timeout and ChangeList to ctx context and auto triggers changes. Thus ctx should not be used when having multiple request in a QueueRequest function, instead use SendRequest and SendRequestRaw internally in f. Changes can also be handled "manually" with the help of TriggerContextChanges.

func (*State) QueueRequestRaw added in v0.17.2

func (state *State) QueueRequestRaw(f func(ctx context.Context) (json.RawMessage, error), actionState *action.State, failOnError bool, errMsg string)

QueueRequestRaw same as QueueRequestAsync but accepts function returning (json.RawMessage, error), to be used when sending Raw functions where the response is not actually used

func (*State) QueueRequestWithCallback

func (state *State) QueueRequestWithCallback(f func(ctx context.Context) error, actionState *action.State, failOnError bool, errMsg string, callback func(err error))

QueueRequestWithCallback Async request, add error to action state or log as warning depending on failOnError flag. This method adds timeout and ChangeList to ctx context and auto triggers changes. Thus ctx should not be used when having multiple request in a QueueRequest function, instead use SendRequest and SendRequestRaw internally in f. Changes can also be handled "manually" with the help of TriggerContextChanges.

func (*State) Randomizer

func (state *State) Randomizer() helpers.Randomizer

Randomizer get randomizer for session

func (*State) ReOpenDoc added in v0.16.5

func (state *State) ReOpenDoc(actionState *action.State, upLink *enigmahandlers.SenseUplink) (*enigma.Doc, error)

ReOpenDoc get active doc from engine

func (*State) Reconnect added in v0.5.7

func (state *State) Reconnect() error

Reconnect attempts reconnecting to previously opened app

func (*State) RegisterEvent

func (state *State) RegisterEvent(handle int,
	event func(ctx context.Context, actionState *action.State) error,
	onClose func(), failOnError bool)

RegisterEvent register function to be executed on object change

func (*State) ReplaceSessionVariables

func (state *State) ReplaceSessionVariables(input *synced.Template) (string, error)

ReplaceSessionVariables execute template and replace session variables, e.g. "my app ({{.UserName}})" -> "my app (user_1)"

func (*State) ReplaceSessionVariablesWithLocalData

func (state *State) ReplaceSessionVariablesWithLocalData(input *synced.Template, localData interface{}) (string, error)

ReplaceSessionVariablesWithLocalData execute template and replace session variables, e.g. "my app ({{.UserName}})" -> "my app (user_1)", extra "local" data can be added in addition to the session variables

func (*State) ReqContext

func (state *State) ReqContext() (context.Context, *enigma.ChangeLists, context.CancelFunc)

ReqContext context to be used on request, includes timeout and changeList to be used for synchronizing changes. A request context is automatically added when using QueueRequest functions.

func (*State) Reset

func (state *State) Reset(ctx context.Context)

Reset session, to be used when an existing session state enters a new "sequence"

func (*State) SendRequest

func (state *State) SendRequest(actionState *action.State, f func(ctx context.Context) error) error

SendRequest and trigger any object changes synchronously

func (*State) SendRequestRaw

func (state *State) SendRequestRaw(actionState *action.State, f func(ctx context.Context) (json.RawMessage, error)) (json.RawMessage, error)

SendRequestRaw send request, trigger any object changes synchronously and return raw json response.

func (*State) SetLogEntry

func (state *State) SetLogEntry(entry *logger.LogEntry)

SetLogEntry set the log entry

func (*State) SetRandomizer

func (state *State) SetRandomizer(rnd helpers.Randomizer, force bool)

SetRandomizer set randomizer for session, will not be set if already has a randomizer on concurrent sets, first instance to acquire lock will "win". When setting to nil, it will be automatically forced. Set force flag to have randomizer set even when a randomizer exists.

func (*State) SetReconnectFunc added in v0.5.7

func (state *State) SetReconnectFunc(f func(bool) (string, error))

SetReconnectFunc sets current app re-connect function

func (*State) SetTargetEnv added in v0.18.0

func (state *State) SetTargetEnv(env string)

SetTargetEnv set current target environment

func (*State) SetVariableValue added in v0.11.0

func (state *State) SetVariableValue(variable string, value interface{})

SetVariableValue to session variable map

func (*State) SetupChangeChan added in v0.5.7

func (state *State) SetupChangeChan() error

SetupChangeChan start listening to enigma change channel

func (*State) SetupEventWebsocketAsync added in v0.6.0

func (state *State) SetupEventWebsocketAsync(actionState *action.State, nurl neturl.URL, allowuntrusted bool)

SetupEventWebsocketAsync setup event websocket and listener

func (*State) TargetEnv added in v0.18.0

func (state *State) TargetEnv() string

TargetEnv currently set target enviroment

func (*State) TrafficLogger

func (state *State) TrafficLogger() enigmahandlers.ITrafficLogger

TrafficLogger returns the current trafficLogger

func (*State) TriggerContextChanges

func (state *State) TriggerContextChanges(ctx context.Context, actionState *action.State)

TriggerContextChanges gets ChangeList from context and triggers changes

func (*State) TriggerEvents

func (state *State) TriggerEvents(actionState *action.State, chHandles, clHandles []int)

TriggerEvents from change and close lists

func (*State) UpdateFeatureMap added in v0.6.23

func (state *State) UpdateFeatureMap(host string, actionState *action.State)

UpdateFeatureMap request features from server and updates feature map

func (*State) WSFailed

func (state *State) WSFailed()

WSFailed Should be executed on websocket unexpectedly failing

func (*State) Wait

func (state *State) Wait(actionState *action.State) bool

Wait for all pending requests to finish, returns true if action state has been marked as failed

type TemplateArtifactMap added in v0.17.13

type TemplateArtifactMap struct {
	// contains filtered or unexported fields
}

func (*TemplateArtifactMap) GetIDByTypeAndName added in v0.17.13

func (artifacts *TemplateArtifactMap) GetIDByTypeAndName(artifactType, name string) (string, error)

func (*TemplateArtifactMap) GetNameByTypeAndID added in v0.17.13

func (artifacts *TemplateArtifactMap) GetNameByTypeAndID(artifactType, id string) (string, error)

type Transport

type Transport struct {
	*http.Transport
	*State
}

Transport http transport interceptor

func (*Transport) RoundTrip

func (transport *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implement RoundTripper interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL