scriptenv

package
v0.0.0-...-f5406f0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const PostScriptPrefix = "postscript"
View Source
const PreScriptPrefix = "prescript"

Variables

View Source
var TrowErrorForUnknownDerefName = false

Functions

func RemoveScriptInputs

func RemoveScriptInputs(inputs map[string]interface{}) map[string]interface{}

Types

type Auth

type Auth interface {
	ExchangeUserToken(userid string) (token auth.Token, err error)
}

type ScriptEnv

type ScriptEnv struct {
	Variables        map[string]interface{}
	VariablesUpdates map[string]interface{}
	Inputs           map[string]interface{}
	Outputs          map[string]interface{}
	// contains filtered or unexported fields
}

func NewScriptEnv

func NewScriptEnv(auth Auth, iotClient client.Interface, userId string, variables map[string]interface{}, inputs map[string]interface{}, outputs map[string]interface{}) *ScriptEnv

func (*ScriptEnv) GetEnvironment

func (this *ScriptEnv) GetEnvironment() map[string]interface{}

func (*ScriptEnv) GetOutputs

func (this *ScriptEnv) GetOutputs() map[string]interface{}

func (*ScriptEnv) GetUpdatedVariables

func (this *ScriptEnv) GetUpdatedVariables() map[string]interface{}

func (*ScriptEnv) GetVm

func (this *ScriptEnv) GetVm() *goja.Runtime

func (*ScriptEnv) RegisterRuntime

func (this *ScriptEnv) RegisterRuntime(runtime *goja.Runtime)

type ScriptEnvDeviceRepo

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

func NewDeviceRepoScriptEnv

func NewDeviceRepoScriptEnv(env *ScriptEnv) *ScriptEnvDeviceRepo

func (*ScriptEnvDeviceRepo) GetAspect

func (this *ScriptEnvDeviceRepo) GetAspect(id string) models.Aspect

func (*ScriptEnvDeviceRepo) GetAspectNode

func (this *ScriptEnvDeviceRepo) GetAspectNode(id string) models.AspectNode

func (*ScriptEnvDeviceRepo) GetAspectNodes

func (this *ScriptEnvDeviceRepo) GetAspectNodes() []models.AspectNode

func (*ScriptEnvDeviceRepo) GetAspectNodesByIdList

func (this *ScriptEnvDeviceRepo) GetAspectNodesByIdList(ids []string) []models.AspectNode

func (*ScriptEnvDeviceRepo) GetAspectNodesMeasuringFunctions

func (this *ScriptEnvDeviceRepo) GetAspectNodesMeasuringFunctions(id string, ancestors bool, descendants bool) []models.Function

func (*ScriptEnvDeviceRepo) GetAspectNodesWithMeasuringFunction

func (this *ScriptEnvDeviceRepo) GetAspectNodesWithMeasuringFunction(ancestors bool, descendants bool) []models.AspectNode

func (*ScriptEnvDeviceRepo) GetAspects

func (this *ScriptEnvDeviceRepo) GetAspects() []models.Aspect

func (*ScriptEnvDeviceRepo) GetAspectsWithMeasuringFunction

func (this *ScriptEnvDeviceRepo) GetAspectsWithMeasuringFunction(ancestors bool, descendants bool) []models.Aspect

func (*ScriptEnvDeviceRepo) GetCharacteristic

func (this *ScriptEnvDeviceRepo) GetCharacteristic(id string) models.Characteristic

func (*ScriptEnvDeviceRepo) GetConceptWithCharacteristics

func (this *ScriptEnvDeviceRepo) GetConceptWithCharacteristics(id string) models.ConceptWithCharacteristics

func (*ScriptEnvDeviceRepo) GetConceptWithoutCharacteristics

func (this *ScriptEnvDeviceRepo) GetConceptWithoutCharacteristics(id string) models.Concept

func (*ScriptEnvDeviceRepo) GetDeviceClass

func (this *ScriptEnvDeviceRepo) GetDeviceClass(id string) models.DeviceClass

func (*ScriptEnvDeviceRepo) GetDeviceClasses

func (this *ScriptEnvDeviceRepo) GetDeviceClasses() []models.DeviceClass

func (*ScriptEnvDeviceRepo) GetDeviceClassesControllingFunctions

func (this *ScriptEnvDeviceRepo) GetDeviceClassesControllingFunctions(id string) []models.Function

func (*ScriptEnvDeviceRepo) GetDeviceClassesFunctions

func (this *ScriptEnvDeviceRepo) GetDeviceClassesFunctions(id string) []models.Function

func (*ScriptEnvDeviceRepo) GetDeviceClassesWithControllingFunctions

func (this *ScriptEnvDeviceRepo) GetDeviceClassesWithControllingFunctions() []models.DeviceClass

func (*ScriptEnvDeviceRepo) GetDeviceTypeSelectables

func (this *ScriptEnvDeviceRepo) GetDeviceTypeSelectables(query []model.FilterCriteria, pathPrefix string, includeModified bool, servicesMustMatchAllCriteria bool) []model.DeviceTypeSelectable

func (*ScriptEnvDeviceRepo) GetFunction

func (this *ScriptEnvDeviceRepo) GetFunction(id string) models.Function

func (*ScriptEnvDeviceRepo) GetFunctionsByType

func (this *ScriptEnvDeviceRepo) GetFunctionsByType(rdfType string) []models.Function

func (*ScriptEnvDeviceRepo) GetLeafCharacteristics

func (this *ScriptEnvDeviceRepo) GetLeafCharacteristics() []models.Characteristic

func (*ScriptEnvDeviceRepo) GetLocation

func (this *ScriptEnvDeviceRepo) GetLocation(id string) models.Location

func (*ScriptEnvDeviceRepo) GetService

func (this *ScriptEnvDeviceRepo) GetService(id string) models.Service

func (*ScriptEnvDeviceRepo) ListDeviceTypes

func (this *ScriptEnvDeviceRepo) ListDeviceTypes(limit int64, offset int64, sort string, filter []model.FilterCriteria, includeModified bool, includeUnmodified bool) []models.DeviceType

func (*ScriptEnvDeviceRepo) ListHubDeviceIds

func (this *ScriptEnvDeviceRepo) ListHubDeviceIds(id string, asLocalId bool) []string

func (*ScriptEnvDeviceRepo) ReadDevice

func (this *ScriptEnvDeviceRepo) ReadDevice(id string) models.Device

func (*ScriptEnvDeviceRepo) ReadDeviceByLocalId

func (this *ScriptEnvDeviceRepo) ReadDeviceByLocalId(localId string) models.Device

func (*ScriptEnvDeviceRepo) ReadDeviceGroup

func (this *ScriptEnvDeviceRepo) ReadDeviceGroup(id string) models.DeviceGroup

func (*ScriptEnvDeviceRepo) ReadDeviceType

func (this *ScriptEnvDeviceRepo) ReadDeviceType(id string) models.DeviceType

func (*ScriptEnvDeviceRepo) ReadHub

func (this *ScriptEnvDeviceRepo) ReadHub(id string) models.Hub

type ScriptEnvInputs

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

func NewInputsScriptEnv

func NewInputsScriptEnv(env *ScriptEnv) *ScriptEnvInputs

func (*ScriptEnvInputs) Exists

func (this *ScriptEnvInputs) Exists(name string) bool

Exists checks if a process worker input exists

func (*ScriptEnvInputs) Get

func (this *ScriptEnvInputs) Get(name string) interface{}

Get value of a process worker input

func (*ScriptEnvInputs) List

func (this *ScriptEnvInputs) List() []interface{}

List input values sorted by their names

func (*ScriptEnvInputs) ListNames

func (this *ScriptEnvInputs) ListNames() []string

ListNames lists sorted input names

type ScriptEnvOutputs

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

func NewOutputsScriptEnv

func NewOutputsScriptEnv(env *ScriptEnv) *ScriptEnvOutputs

func (*ScriptEnvOutputs) Get

func (this *ScriptEnvOutputs) Get(name string) interface{}

Get a process worker output

func (*ScriptEnvOutputs) Set

func (this *ScriptEnvOutputs) Set(name string, value interface{})

Set a process worker output

func (*ScriptEnvOutputs) SetJson

func (this *ScriptEnvOutputs) SetJson(name string, value interface{})

SetJson marshals the given value to json and sets it as a process worker output

type ScriptEnvUtil

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

func NewScriptEnvUtil

func NewScriptEnvUtil(env *ScriptEnv) *ScriptEnvUtil

func (*ScriptEnvUtil) GetDevicesWithServiceFromEntityString

func (this *ScriptEnvUtil) GetDevicesWithServiceFromEntityString(entityStr string, criteria []devicemodel.FilterCriteria) []model.IotOption

GetDevicesWithServiceFromEntityString finds a list of iot-options where the entity is the same the input, but the Service field is set with those that match the input criteria

func (*ScriptEnvUtil) GetDevicesWithServiceFromIotOption

func (this *ScriptEnvUtil) GetDevicesWithServiceFromIotOption(entity model.IotOption, criteria []devicemodel.FilterCriteria) []model.IotOption

GetDevicesWithServiceFromIotOption finds a list of iot-options where the entity is the same the input, but the Service field is set with those that match the input criteria

func (*ScriptEnvUtil) GroupIotOptionsByDevice

func (this *ScriptEnvUtil) GroupIotOptionsByDevice(entities []model.IotOption) map[string][]model.IotOption

GroupIotOptionsByDevice groups a list of model.IotOption by their device id; options that are not devices will be grouped under ""

func (*ScriptEnvUtil) GroupIotOptionsByService

func (this *ScriptEnvUtil) GroupIotOptionsByService(entities []model.IotOption) map[string][]model.IotOption

GroupIotOptionsByService groups a list of IotOption by their service id; options that are not devices or dont hav a service-id will be grouped under ""

func (*ScriptEnvUtil) IsDeviceGroupIotOption

func (this *ScriptEnvUtil) IsDeviceGroupIotOption(entity model.IotOption) bool

IsDeviceGroupIotOption checks if the input is a device-group

func (*ScriptEnvUtil) IsDeviceGroupIotOptionStr

func (this *ScriptEnvUtil) IsDeviceGroupIotOptionStr(entityStr string) bool

IsDeviceGroupIotOptionStr checks if the input is a device-group

func (*ScriptEnvUtil) IsDeviceIotOption

func (this *ScriptEnvUtil) IsDeviceIotOption(entity model.IotOption) bool

IsDeviceIotOption checks if the input is a device

func (*ScriptEnvUtil) IsDeviceIotOptionStr

func (this *ScriptEnvUtil) IsDeviceIotOptionStr(entityStr string) bool

IsDeviceIotOptionStr checks if the input is a device

func (*ScriptEnvUtil) IsImportIotOption

func (this *ScriptEnvUtil) IsImportIotOption(entity model.IotOption) bool

IsImportIotOption checks if the input is a import

func (*ScriptEnvUtil) IsImportIotOptionStr

func (this *ScriptEnvUtil) IsImportIotOptionStr(entityStr string) bool

IsImportIotOptionStr checks if the input is a import

type ScriptEnvVariables

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

func NewVariablesScriptEnv

func NewVariablesScriptEnv(env *ScriptEnv) *ScriptEnvVariables

func (*ScriptEnvVariables) DerefName

func (this *ScriptEnvVariables) DerefName(ref string) string

DerefName returns the name of a smart-service instance variable referenced in parameter ref

func (*ScriptEnvVariables) DerefTemplate

func (this *ScriptEnvVariables) DerefTemplate(templ string) string

DerefTemplate replaces variable references in the input string with the corresponding variable values

func (*ScriptEnvVariables) DerefValue

func (this *ScriptEnvVariables) DerefValue(ref string) interface{}

DerefValue returns the value of a smart-service instance variable referenced in parameter ref

func (*ScriptEnvVariables) Exists

func (this *ScriptEnvVariables) Exists(name string) bool

Exists checks if a smart-service instance variable exists

func (*ScriptEnvVariables) Read

func (this *ScriptEnvVariables) Read(name string) interface{}

Read value of a smart-service instance variable

func (*ScriptEnvVariables) Ref

func (this *ScriptEnvVariables) Ref(name string) string

Ref creates a reference to a variable (e.g. "my_var_name" --> "{{.my_var_name}}") throws exception if variable is unknown

func (*ScriptEnvVariables) Write

func (this *ScriptEnvVariables) Write(name string, value interface{})

Write value as smart-service instance variable

type VariablesRepo

type VariablesRepo interface {
	GetVariables(processId string) (result map[string]interface{}, err error)
	SetVariables(processId string, changes map[string]interface{}) error
	GetInstanceUser(instanceId string) (userId string, err error)
}

Jump to

Keyboard shortcuts

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