Documentation ¶
Index ¶
- Constants
- Variables
- func CheckResponseStatus(request *RestRequest, statusCodes []int) error
- func DefaultClient(connectionSettings ConnectionSettings, state *State) (*http.Client, error)
- func GetAndAddObjectAsync(sessionState *State, actionState *action.State, name string)
- func GetAndAddObjectSync(sessionState *State, actionState *action.State, name string)
- func GetApproriateNrOfBins(hypercube *enigmahandlers.HyperCube) int
- func GetFullContinuousRange(hypercube *enigmahandlers.HyperCube) (enigma.Float64, enigma.Float64, error)
- func GetObjectLayout(sessionState *State, actionState *action.State, obj *enigmahandlers.Object) error
- func GetObjectProperties(sessionState *State, actionState *action.State, obj *enigmahandlers.Object) error
- func SetChildList(rawLayout json.RawMessage, obj *enigmahandlers.Object) error
- func SetChildren(rawLayout json.RawMessage, obj *enigmahandlers.Object) error
- func SetHyperCube(rawLayout json.RawMessage, obj *enigmahandlers.Object, ...) error
- func SetListObject(rawLayout json.RawMessage, obj *enigmahandlers.Object, ...) error
- func SetObjectData(sessionState *State, actionState *action.State, rawLayout json.RawMessage, ...) error
- func SetObjectDataAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, ...)
- func UpdateListObjectDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, ...)
- func UpdateObjectHyperCubeBinnedDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, ...)
- func UpdateObjectHyperCubeContinuousDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, ...)
- func UpdateObjectHyperCubeDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, ...)
- func UpdateObjectHyperCubeReducedDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, ...)
- func UpdateObjectHyperCubeStackDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, ...)
- func WarnOrError(actionState *action.State, logEntry *logger.LogEntry, failOnError bool, ...)
- type AppData
- type AppSelection
- type AppSelectionCore
- type AppSelectionModeEnum
- type AppsResp
- type ArtifactEntry
- type ArtifactListDict
- type ArtifactMap
- func (am *ArtifactMap) AddSpace(space elasticstructs.Space)
- func (am *ArtifactMap) DeleteApp(AppGUID string)
- func (am *ArtifactMap) DeleteStream(streamName string)
- func (am *ArtifactMap) EmptyApps()
- func (am *ArtifactMap) FillAppsUsingDocListEntries(docListEntries []*enigma.DocListEntry) error
- func (am *ArtifactMap) FillAppsUsingName(appData *AppData) error
- func (am *ArtifactMap) FillAppsUsingTitle(appData *AppData) error
- func (am *ArtifactMap) FillSpaces(spaces []elasticstructs.Space)
- func (am *ArtifactMap) FillStreams(streamList []elasticstructs.Collection)
- func (am *ArtifactMap) GetAppID(appName string) (string, error)
- func (am *ArtifactMap) GetItemId(appName string) (string, error)
- func (am *ArtifactMap) GetRandomApp(sessionState *State) (ArtifactEntry, error)
- func (am *ArtifactMap) GetRoundRobin(sessionState *State) (ArtifactEntry, error)
- func (am *ArtifactMap) GetSpaceByID(spaceID string) (*elasticstructs.Space, error)
- func (am *ArtifactMap) GetSpaceByName(spaceName string) (*elasticstructs.Space, error)
- func (am *ArtifactMap) GetStreamID(streamName string) (string, error)
- func (am *ArtifactMap) Json() ([]byte, error)
- func (am *ArtifactMap) LogMap(entry *logger.LogEntry) error
- func (am *ArtifactMap) LookupAppGUID(sessionState *State, guid string) (*ArtifactEntry, error)
- func (am *ArtifactMap) LookupAppTitle(sessionState *State, title string) (*ArtifactEntry, error)
- type AutoChartHandler
- type AutoChartInstance
- func (instance *AutoChartInstance) GetObjectDefinition(objectType string) (string, senseobjdef.SelectType, senseobjdef.DataDefType, error)
- func (instance *AutoChartInstance) SetObjectAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, ...)
- func (instance *AutoChartInstance) SetObjectDefData(objDefData []senseobjdef.Data)
- type ConnectionSettings
- type DefaultHandler
- type DefaultHandlerInstance
- type DefaultRandomizer
- type DuplicateKeyError
- type Event
- type EventMetricsLogger
- type HeaderJar
- type IConnection
- type IDMap
- type NoActiveDocError
- type ObjectHandler
- type ObjectHandlerInstance
- type PendingHandler
- type ReconnectInfo
- type ReconnectSettings
- type ReqOptions
- type RestHandler
- func (handler *RestHandler) DecPending(request *RestRequest)
- func (handler *RestHandler) FireOffGet(url string, actionState *action.State, failOnError bool) *RestRequest
- func (handler *RestHandler) FireOffGetWithCallback(url string, actionState *action.State, failOnError bool, ...) *RestRequest
- func (handler *RestHandler) GetAsync(url string, actionState *action.State, logEntry *logger.LogEntry, ...) *RestRequest
- func (handler *RestHandler) GetAsyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, ...) *RestRequest
- func (handler *RestHandler) GetSync(url string, actionState *action.State, logEntry *logger.LogEntry, ...) (*RestRequest, error)
- func (handler *RestHandler) GetSyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, ...) (*RestRequest, error)
- func (handler *RestHandler) GetWithHeadersAsync(url string, actionState *action.State, logEntry *logger.LogEntry, ...) *RestRequest
- func (handler *RestHandler) IncPending()
- func (handler *RestHandler) PostAsync(url string, actionState *action.State, logEntry *logger.LogEntry, ...) *RestRequest
- func (handler *RestHandler) PostAsyncWithCallback(url string, actionState *action.State, logEntry *logger.LogEntry, ...) *RestRequest
- func (handler *RestHandler) PostWithHeadersAsync(url string, actionState *action.State, logEntry *logger.LogEntry, ...) *RestRequest
- func (handler *RestHandler) QueueRequest(actionState *action.State, failOnError bool, request *RestRequest, ...)
- func (handler *RestHandler) QueueRequestWithCallback(actionState *action.State, failOnError bool, request *RestRequest, ...)
- func (handler *RestHandler) SetClient(client *http.Client)
- func (handler *RestHandler) WaitForPending()
- type RestMethod
- type RestRequest
- type SessionVariables
- type SpaceIdNotFoundError
- type SpaceNameNotFoundError
- type State
- func (state *State) AwaitReconnect()
- func (state *State) BaseContext() context.Context
- func (state *State) Cancel()
- func (state *State) ContextChangeList() (context.Context, *enigma.ChangeLists)
- func (state *State) ContextWithTimeout(ctx context.Context) (context.Context, context.CancelFunc)
- func (state *State) CurrentSenseApp() (*senseobjects.App, error)
- func (state *State) CurrentSenseUplink() (*enigmahandlers.SenseUplink, error)
- func (state *State) DeRegisterEvent(handle int)
- func (state *State) DeRegisterEvents(handles []int)
- func (state *State) DeregisterAllEvents()
- func (state *State) Disconnect()
- func (state *State) EventWebsocket() *eventws.EventWebsocket
- func (state *State) GetActiveDoc(actionState *action.State, upLink *enigmahandlers.SenseUplink) (*enigma.Doc, error)
- func (state *State) GetObjectHandlerInstance(id, typ string) ObjectHandlerInstance
- func (state *State) GetReconnectError() error
- func (state *State) GetSessionVariable(localData interface{}) SessionVariables
- func (state *State) GetSheet(actionState *action.State, upLink *enigmahandlers.SenseUplink, id string) (*enigmahandlers.Object, *senseobjects.Sheet, error)
- func (state *State) GetSheetList(actionState *action.State, uplink *enigmahandlers.SenseUplink)
- func (state *State) IsAbortTriggered() bool
- func (state *State) IsSenseWebsocketDisconnected(err error) bool
- func (state *State) QueueRequest(f func(ctx context.Context) error, actionState *action.State, failOnError bool, ...)
- func (state *State) QueueRequestWithCallback(f func(ctx context.Context) error, actionState *action.State, failOnError bool, ...)
- func (state *State) Randomizer() helpers.Randomizer
- func (state *State) Reconnect() error
- func (state *State) RegisterEvent(handle int, event func(ctx context.Context, actionState *action.State) error, ...)
- func (state *State) ReplaceSessionVariables(input *SyncedTemplate) (string, error)
- func (state *State) ReplaceSessionVariablesWithLocalData(input *SyncedTemplate, localData interface{}) (string, error)
- func (state *State) ReqContext() (context.Context, *enigma.ChangeLists, context.CancelFunc)
- func (state *State) Reset(ctx context.Context)
- func (state *State) SendRequest(actionState *action.State, f func(ctx context.Context) error) error
- func (state *State) SendRequestRaw(actionState *action.State, ...) (json.RawMessage, error)
- func (state *State) SetLogEntry(entry *logger.LogEntry)
- func (state *State) SetRandomizer(rnd helpers.Randomizer, force bool)
- func (state *State) SetReconnectFunc(f func() (string, error))
- func (state *State) SetupChangeChan() error
- func (state *State) SetupEventWebsocketAsync(actionState *action.State, nurl neturl.URL, allowuntrusted bool)
- func (state *State) TrafficLogger() enigmahandlers.ITrafficLogger
- func (state *State) TriggerContextChanges(ctx context.Context, actionState *action.State)
- func (state *State) TriggerEvents(actionState *action.State, chHandles, clHandles []int)
- func (state *State) WSFailed()
- func (state *State) Wait(actionState *action.State) bool
- type SyncedTemplate
- func (syn *SyncedTemplate) Execute(writer io.Writer, data interface{}) error
- func (syn SyncedTemplate) MarshalJSON() ([]byte, error)
- func (input *SyncedTemplate) ReplaceWithoutSessionVariables(data interface{}) (string, error)
- func (syn *SyncedTemplate) String() string
- func (syn SyncedTemplate) TreatAs() string
- func (syn *SyncedTemplate) UnmarshalJSON(arg []byte) error
- type Transport
Constants ¶
const ( EventWsReconnectStarted = "eventws.reconnect.started" EventWsReconnectEnded = "eventws.reconnect.ended" )
Fake "events" for event websocket
const ( // DefaultTimeout per request timeout DefaultTimeout = 300 * time.Second )
const (
GeneratedPropertiesPath = "/qUndoExclude/generated"
)
Variables ¶
var (
GlobalObjectHandler objectHandlerMap
)
Functions ¶
func CheckResponseStatus ¶
func CheckResponseStatus(request *RestRequest, statusCodes []int) error
CheckResponseStatus validates that a response has acceptable
func DefaultClient ¶
func DefaultClient(connectionSettings ConnectionSettings, state *State) (*http.Client, error)
DefaultClient creates client instance with default client settings
func GetAndAddObjectAsync ¶ added in v0.5.3
GetAndAddObjectAsync get and add object to object handling
func GetAndAddObjectSync ¶ added in v0.5.7
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 GetObjectProperties ¶ added in v0.5.3
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 senseobjdef.DataPath) error
func SetListObject ¶ added in v0.5.3
func SetListObject(rawLayout json.RawMessage, obj *enigmahandlers.Object, path senseobjdef.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 SetObjectDataAndEvents ¶ added in v0.5.3
func SetObjectDataAndEvents(sessionState *State, actionState *action.State, obj *enigmahandlers.Object, genObj *enigma.GenericObject)
func UpdateListObjectDataAsync ¶ added in v0.5.3
func UpdateListObjectDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)
func UpdateObjectHyperCubeBinnedDataAsync ¶ added in v0.5.3
func UpdateObjectHyperCubeBinnedDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)
func UpdateObjectHyperCubeContinuousDataAsync ¶ added in v0.5.3
func UpdateObjectHyperCubeContinuousDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)
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)
func UpdateObjectHyperCubeReducedDataAsync ¶ added in v0.5.3
func UpdateObjectHyperCubeReducedDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)
func UpdateObjectHyperCubeStackDataAsync ¶ added in v0.5.3
func UpdateObjectHyperCubeStackDataAsync(sessionState *State, actionState *action.State, gob *enigma.GenericObject, obj *enigmahandlers.Object, requestDef senseobjdef.GetDataRequests)
Types ¶
type AppData ¶
type AppData struct {
Data []AppsResp `json:"data"`
}
AppData struct to unmarshal list app response
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 SyncedTemplate `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 ¶
ArtifactEntry is a key value pair
func (*ArtifactEntry) Copy ¶
func (entry *ArtifactEntry) Copy() *ArtifactEntry
Copy of ArtifactEntry
func (*ArtifactEntry) IsEmpty ¶
func (entry *ArtifactEntry) IsEmpty() bool
IsEmpty returns true of entry is nil or has no GUID
type ArtifactListDict ¶
type ArtifactListDict []*ArtifactEntry
func (ArtifactListDict) Len ¶
func (d ArtifactListDict) Len() int
func (ArtifactListDict) Less ¶
func (d ArtifactListDict) Less(i, j int) bool
func (ArtifactListDict) Swap ¶
func (d ArtifactListDict) Swap(i, j int)
type ArtifactMap ¶
type ArtifactMap struct { AppList ArtifactListDict // contains filtered or unexported fields }
ArtifactMap is the map between app names and GUIDs
func (*ArtifactMap) AddSpace ¶
func (am *ArtifactMap) AddSpace(space elasticstructs.Space)
AddSpace to artifact map
func (*ArtifactMap) DeleteApp ¶
func (am *ArtifactMap) DeleteApp(AppGUID string)
DeleteApp deletes an app from the ArtifactMap
func (*ArtifactMap) DeleteStream ¶
func (am *ArtifactMap) DeleteStream(streamName string)
DeleteStream deletes a stream from the ArtifactMap
func (*ArtifactMap) EmptyApps ¶
func (am *ArtifactMap) EmptyApps()
EmptyApps Empty Apps from ArtifactMap
func (*ArtifactMap) FillAppsUsingDocListEntries ¶
func (am *ArtifactMap) FillAppsUsingDocListEntries(docListEntries []*enigma.DocListEntry) error
FillAppsUsingDocListEntries should be used to fillAppMap app map in QSEfW
func (*ArtifactMap) FillAppsUsingName ¶
func (am *ArtifactMap) FillAppsUsingName(appData *AppData) error
FillAppsUsingName should be used to fillAppMap app map in QCS
func (*ArtifactMap) FillAppsUsingTitle ¶
func (am *ArtifactMap) FillAppsUsingTitle(appData *AppData) error
FillAppsUsingTitle should be used to fillAppMap app map in QSCB
func (*ArtifactMap) FillSpaces ¶
func (am *ArtifactMap) FillSpaces(spaces []elasticstructs.Space)
FillSpaces fills the spaces map with the spaces from the given list
func (*ArtifactMap) FillStreams ¶
func (am *ArtifactMap) FillStreams(streamList []elasticstructs.Collection)
FillStreams fills the stream map with the streams from the given list
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) GetItemId ¶
func (am *ArtifactMap) GetItemId(appName string) (string, error)
GetItemId 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) GetSpaceByID ¶
func (am *ArtifactMap) GetSpaceByID(spaceID string) (*elasticstructs.Space, error)
GetSpaceByID returns the space ID given space name
func (*ArtifactMap) GetSpaceByName ¶
func (am *ArtifactMap) GetSpaceByName(spaceName string) (*elasticstructs.Space, error)
GetSpaceByName returns the space ID given space name
func (*ArtifactMap) GetStreamID ¶
func (am *ArtifactMap) GetStreamID(streamName string) (string, error)
GetStreamID returns the app ID given the stream
func (*ArtifactMap) Json ¶
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) LookupAppGUID ¶
func (am *ArtifactMap) LookupAppGUID(sessionState *State, guid string) (*ArtifactEntry, error)
SetCurrentAppTitle lookup app using GUID
func (*ArtifactMap) LookupAppTitle ¶
func (am *ArtifactMap) LookupAppTitle(sessionState *State, title string) (*ArtifactEntry, error)
LookupAppTitle lookup app using title
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 ConnectionSettings ¶
type ConnectionSettings interface {
AllowUntrusted() bool
}
ConnectionSettings interface
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
func (*EventMetricsLogger) SocketOpenMetric ¶ added in v0.6.0
func (lgr *EventMetricsLogger) SocketOpenMetric(url *neturl.URL, duration time.Duration)
type HeaderJar ¶
type HeaderJar struct {
// contains filtered or unexported fields
}
HeaderJar map between hosts and headers
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) IsDuplicateKey ¶
IsDuplicateKey returns already in case of duplicate key
type NoActiveDocError ¶ added in v0.5.7
func (NoActiveDocError) Error ¶ added in v0.5.7
func (err NoActiveDocError) Error() string
Error implements 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 PendingHandler ¶
type PendingHandler struct {
// contains filtered or unexported fields
}
PendingHandler handles waiting for pending requests and responses
func NewPendingHandler ¶
func NewPendingHandler(size int) PendingHandler
NewPendingHandler new instance of PendingHandler
func (*PendingHandler) DecPending ¶
func (pending *PendingHandler) DecPending()
DecPending increase finished requests
func (*PendingHandler) IncPending ¶
func (pending *PendingHandler) IncPending()
IncPending increase pending requests
func (*PendingHandler) QueueRequest ¶
func (pending *PendingHandler) QueueRequest(baseCtx context.Context, timeout time.Duration, f func(ctx context.Context) error, logEntry *logger.LogEntry, onFinished func(err error))
QueueRequest Async request,
func (*PendingHandler) WaitForPending ¶
func (pending *PendingHandler) WaitForPending(ctx context.Context)
WaitForPending uses double locking of mutex to wait until mutex is unlocked by loop listening for pending req/resp
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"` // Backoff pattern for reconnect, if empty defaults to defaultReconnectBackoff Backoff []float64 `json:"backoff" doc-key:"reconnectsettings.backoff"` }
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 ¶
RestHandler handles waiting for pending requests and responses
func NewRestHandler ¶
func NewRestHandler(ctx context.Context, size int, 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) FireOffGet ¶
func (handler *RestHandler) FireOffGet(url string, actionState *action.State, failOnError bool) *RestRequest
FireOffGet request Deprecated: Replace with GetAsync or QueueRequest
func (*RestHandler) FireOffGetWithCallback ¶
func (handler *RestHandler) FireOffGetWithCallback(url string, actionState *action.State, failOnError bool, callback func(err error, req *RestRequest)) *RestRequest
FireOffGet request with callback Deprecated: Replace with GetAsyncWithCallback or QueueRequestWithCallback
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) 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) 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) IncPending ¶
func (handler *RestHandler) IncPending()
IncPending increase pending requests
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
PostAsync 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
PostWithHeaderAsync send async POST 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))
QueueRequest 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 )
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 SessionVariables ¶
SessionVariables is used as a data carrier for session variables.
type SpaceIdNotFoundError ¶ added in v0.5.0
type SpaceIdNotFoundError string
func (SpaceIdNotFoundError) Error ¶ added in v0.5.0
func (err SpaceIdNotFoundError) Error() string
type SpaceNameNotFoundError ¶ added in v0.5.0
type SpaceNameNotFoundError string
func (SpaceNameNotFoundError) Error ¶ added in v0.5.0
func (err SpaceNameNotFoundError) Error() string
Error implements error interface
type State ¶
type State struct { Cookies http.CookieJar VirtualProxy string Connection IConnection ArtifactMap *ArtifactMap IDMap IDMap HeaderJar *HeaderJar LoggedIn bool Timeout time.Duration User *users.User OutputsDir string CurrentApp *ArtifactEntry CurrentUser *elasticstructs.User Counters *statistics.ExecutionCounters DataConnectionId string // CurrentActionState will contain the state of the latest action to be started CurrentActionState *action.State LogEntry *logger.LogEntry EW statistics.ErrWarn Pending PendingHandler Rest *RestHandler RequestMetrics *requestmetrics.RequestMetrics ReconnectSettings ReconnectSettings // 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
New instance of session state with custom randomizer
func (*State) AwaitReconnect ¶ added in v0.5.7
func (state *State) AwaitReconnect()
AwaitReconnect awaits any reconnect lock to be released
func (*State) BaseContext ¶
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) ContextChangeList ¶
func (state *State) ContextChangeList() (context.Context, *enigma.ChangeLists)
ContextChangeList create changeList object and context to be used for synchronizing changes
func (*State) ContextWithTimeout ¶
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) CurrentSenseUplink ¶ added in v0.5.7
func (state *State) CurrentSenseUplink() (*enigmahandlers.SenseUplink, error)
CurrentSenseUplink return currently set sense uplink or error if none found
func (*State) DeRegisterEvent ¶
DeRegisterEvent for handle
func (*State) DeRegisterEvents ¶
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) GetActiveDoc ¶ added in v0.5.7
func (state *State) GetActiveDoc(actionState *action.State, upLink *enigmahandlers.SenseUplink) (*enigma.Doc, error)
GetActiveDoc get active doc from engine
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
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 ¶
IsAbortTriggered check if abort has been flagged
func (*State) IsSenseWebsocketDisconnected ¶ added in v0.6.0
IsSenseWebsocketDisconnected checks if error is caused by websocket disconnect
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) 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) 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 *SyncedTemplate) (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 *SyncedTemplate, 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 ¶
Reset session, to be used when an existing session state enters a new "sequence"
func (*State) SendRequest ¶
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 ¶
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
SetReconnectFunc sets current app re-connect function
func (*State) SetupChangeChan ¶ added in v0.5.7
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) TrafficLogger ¶
func (state *State) TrafficLogger() enigmahandlers.ITrafficLogger
TrafficLogger returns the current trafficLogger
func (*State) TriggerContextChanges ¶
TriggerContextChanges gets ChangeList from context and triggers changes
func (*State) TriggerEvents ¶
TriggerEvents from change and close lists
type SyncedTemplate ¶
type SyncedTemplate struct {
// contains filtered or unexported fields
}
Synced Template used for creating templates parsed once
func NewSyncedTemplate ¶
func NewSyncedTemplate(t string) (*SyncedTemplate, error)
NewSyncedTemplate parses string and creates new instance of SyncedTemplate
func (*SyncedTemplate) Execute ¶
func (syn *SyncedTemplate) Execute(writer io.Writer, data interface{}) error
Execute template
func (SyncedTemplate) MarshalJSON ¶
func (syn SyncedTemplate) MarshalJSON() ([]byte, error)
MarshalJSON marshal template to json string
func (*SyncedTemplate) ReplaceWithoutSessionVariables ¶
func (input *SyncedTemplate) ReplaceWithoutSessionVariables(data interface{}) (string, error)
ReplaceWithoutSessionVariables execute template without session variables - only use if we do not have a session
func (*SyncedTemplate) String ¶
func (syn *SyncedTemplate) String() string
String return text pattern
func (SyncedTemplate) TreatAs ¶
func (syn SyncedTemplate) TreatAs() string
func (*SyncedTemplate) UnmarshalJSON ¶
func (syn *SyncedTemplate) UnmarshalJSON(arg []byte) error
UnmarshalJSON un-marshal from json string