controller

package
v0.0.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DisplayNameAttributeName = "shared/nickname"
View Source
const FilterDevicesOfGroupByAccess = true
View Source
const ServiceGroupSelectionIdModifier = "service_group_selection"

Variables

This section is empty.

Functions

func CreateAspectNodes

func CreateAspectNodes(db database.Database, aspect models.Aspect, rootId string, parentId string, ancestors []string) (descendents []string, err error)

func DeviceGroupFilterGenericDuplicateCriteria added in v0.0.3

func DeviceGroupFilterGenericDuplicateCriteria(dg models.DeviceGroup, aspectNodeProvider AspectNodeProvider) (result models.DeviceGroup, err error)

DeviceGroupFilterGenericDuplicateCriteria removes criteria without aspect, that are already present with an aspect ref: https://bitnify.atlassian.net/browse/SNRGY-3027

func ValidateCharacteristicsWithoutDbAccess

func ValidateCharacteristicsWithoutDbAccess(characteristic models.Characteristic) (err error, code int)

func ValidateDeviceName

func ValidateDeviceName(device models.Device) (err error)

func ValidateName

func ValidateName(name string) (err error, code int)

func ValidateServiceGroups

func ValidateServiceGroups(groups []models.ServiceGroup, services []models.Service) error

func ValidateVariableName

func ValidateVariableName(name string) (err error, code int)

Types

type AspectNodeProvider added in v0.0.3

type AspectNodeProvider interface {
	ListAspectNodesByIdList(ctx context.Context, ids []string) ([]models.AspectNode, error)
}

type Controller

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

func New

func New(config config.Config, db database.Database, security Security, producer Producer) (ctrl *Controller, err error)

func (*Controller) CheckAccessToDevicesOfGroup

func (this *Controller) CheckAccessToDevicesOfGroup(token string, group models.DeviceGroup) (err error, code int)

only the first element of group.Devices is checked. this should be enough because every used device should be referenced in each element of group.Devices use ValidateDeviceGroup() to ensure that this constraint is adhered to

func (*Controller) DeleteAspect

func (this *Controller) DeleteAspect(id string) error

func (*Controller) DeleteCharacteristic

func (this *Controller) DeleteCharacteristic(id string) error

func (*Controller) DeleteConcept

func (this *Controller) DeleteConcept(id string) error

func (*Controller) DeleteDevice

func (this *Controller) DeleteDevice(id string) error

func (*Controller) DeleteDeviceClass

func (this *Controller) DeleteDeviceClass(id string) error

func (*Controller) DeleteDeviceGroup

func (this *Controller) DeleteDeviceGroup(id string) error

func (*Controller) DeleteDeviceType

func (this *Controller) DeleteDeviceType(id string) error

func (*Controller) DeleteFunction

func (this *Controller) DeleteFunction(id string) error

func (*Controller) DeleteHub

func (this *Controller) DeleteHub(id string) error

func (*Controller) DeleteLocation

func (this *Controller) DeleteLocation(id string) error

func (*Controller) DeleteProtocol

func (this *Controller) DeleteProtocol(id string) error

func (*Controller) FilterDevicesOfGroupByAccess

func (this *Controller) FilterDevicesOfGroupByAccess(token string, group models.DeviceGroup) (result models.DeviceGroup, err error, code int)

func (*Controller) GetAspect

func (this *Controller) GetAspect(id string) (result models.Aspect, err error, code int)

func (*Controller) GetAspectNode

func (this *Controller) GetAspectNode(id string) (result models.AspectNode, err error, code int)

func (*Controller) GetAspectNodes

func (this *Controller) GetAspectNodes() (result []models.AspectNode, err error, code int)

func (*Controller) GetAspectNodesByIdList

func (this *Controller) GetAspectNodesByIdList(ids []string) (result []models.AspectNode, err error, code int)

func (*Controller) GetAspectNodesMeasuringFunctions

func (this *Controller) GetAspectNodesMeasuringFunctions(aspect string, ancestors bool, descendants bool) (result []models.Function, err error, code int)

returns all measuring functions used in combination with given aspect (and optional its descendants and ancestors)

func (*Controller) GetAspectNodesWithMeasuringFunction

func (this *Controller) GetAspectNodesWithMeasuringFunction(ancestors bool, descendants bool) (result []models.AspectNode, err error, code int)

func (*Controller) GetAspects

func (this *Controller) GetAspects() (result []models.Aspect, err error, code int)

func (*Controller) GetAspectsWithMeasuringFunction

func (this *Controller) GetAspectsWithMeasuringFunction(ancestors bool, descendants bool) (result []models.Aspect, err error, code int)

func (*Controller) GetCharacteristic

func (this *Controller) GetCharacteristic(id string) (result models.Characteristic, err error, errCode int)

func (*Controller) GetConceptWithCharacteristics

func (this *Controller) GetConceptWithCharacteristics(id string) (result models.ConceptWithCharacteristics, err error, code int)

func (*Controller) GetConceptWithoutCharacteristics

func (this *Controller) GetConceptWithoutCharacteristics(id string) (result models.Concept, err error, code int)

func (*Controller) GetDeviceClass

func (this *Controller) GetDeviceClass(id string) (result models.DeviceClass, err error, errCode int)

func (*Controller) GetDeviceClasses

func (this *Controller) GetDeviceClasses() (result []models.DeviceClass, err error, code int)

func (*Controller) GetDeviceClassesControllingFunctions

func (this *Controller) GetDeviceClassesControllingFunctions(deviceClass string) (result []models.Function, err error, code int)

func (*Controller) GetDeviceClassesFunctions

func (this *Controller) GetDeviceClassesFunctions(deviceClass string) (result []models.Function, err error, code int)

func (*Controller) GetDeviceClassesWithControllingFunctions

func (this *Controller) GetDeviceClassesWithControllingFunctions() (result []models.DeviceClass, err error, code int)

func (*Controller) GetDeviceTypeSelectables

func (this *Controller) GetDeviceTypeSelectables(query []model.FilterCriteria, pathPrefix string, interactionsFilter []string, includeModified bool) (result []model.DeviceTypeSelectable, err error, code int)

func (*Controller) GetDeviceTypeSelectablesV2

func (this *Controller) GetDeviceTypeSelectablesV2(query []model.FilterCriteria, pathPrefix string, includeModified bool, servicesMustMatchAllCriteria bool) (result []model.DeviceTypeSelectable, err error, code int)

func (*Controller) GetFunction

func (this *Controller) GetFunction(id string) (result models.Function, err error, code int)

func (*Controller) GetFunctionsByType

func (this *Controller) GetFunctionsByType(rdfType string) (result []models.Function, err error, code int)

func (*Controller) GetLeafCharacteristics

func (this *Controller) GetLeafCharacteristics() (result []models.Characteristic, err error, code int)

func (*Controller) GetLocation

func (this *Controller) GetLocation(id string, token string) (result models.Location, err error, code int)

func (*Controller) GetService

func (this *Controller) GetService(id string) (result models.Service, err error, code int)

func (*Controller) GetUsedInDeviceType added in v0.0.6

func (this *Controller) GetUsedInDeviceType(query model.UsedInDeviceTypeQuery) (result model.UsedInDeviceTypeResponse, err error, errCode int)

func (*Controller) ListDeviceTypes

func (this *Controller) ListDeviceTypes(token string, limit int64, offset int64, sort string, filter []model.FilterCriteria, interactionsFilter []string, includeModified bool, includeUnmodified bool) (result []models.DeviceType, err error, errCode int)

func (*Controller) ListDeviceTypesV2

func (this *Controller) ListDeviceTypesV2(token string, limit int64, offset int64, sort string, filter []model.FilterCriteria, includeModified bool, includeUnmodified bool) (result []models.DeviceType, err error, errCode int)

func (*Controller) ListHubDeviceIds

func (this *Controller) ListHubDeviceIds(id string, token string, action model.AuthAction, asLocalId bool) (result []string, err error, errCode int)

func (*Controller) ListProtocols

func (this *Controller) ListProtocols(token string, limit int64, offset int64, sort string) (result []models.Protocol, err error, errCode int)

func (*Controller) PublishDeviceDelete

func (this *Controller) PublishDeviceDelete(id string, owner string) error

func (*Controller) ReadDevice

func (this *Controller) ReadDevice(id string, token string, action model.AuthAction) (result models.Device, err error, errCode int)

func (*Controller) ReadDeviceByLocalId

func (this *Controller) ReadDeviceByLocalId(localId string, token string, action model.AuthAction) (result models.Device, err error, errCode int)

func (*Controller) ReadDeviceGroup

func (this *Controller) ReadDeviceGroup(id string, token string, filterGenericDuplicateCriteria bool) (result models.DeviceGroup, err error, errCode int)

func (*Controller) ReadDeviceType

func (this *Controller) ReadDeviceType(id string, token string) (result models.DeviceType, err error, errCode int)

func (*Controller) ReadHub

func (this *Controller) ReadHub(id string, token string, action model.AuthAction) (result models.Hub, err error, errCode int)

func (*Controller) ReadProtocol

func (this *Controller) ReadProtocol(id string, token string) (result models.Protocol, err error, errCode int)

func (*Controller) SetAspect

func (this *Controller) SetAspect(aspect models.Aspect, owner string) error

func (*Controller) SetCharacteristic

func (this *Controller) SetCharacteristic(characteristic models.Characteristic, owner string) error

func (*Controller) SetConcept

func (this *Controller) SetConcept(concept models.Concept, owner string) error

func (*Controller) SetDevice

func (this *Controller) SetDevice(device models.Device, owner string) (err error)

func (*Controller) SetDeviceClass

func (this *Controller) SetDeviceClass(class models.DeviceClass, owner string) error

func (*Controller) SetDeviceGroup

func (this *Controller) SetDeviceGroup(deviceGroup models.DeviceGroup, owner string) (err error)

func (*Controller) SetDeviceType

func (this *Controller) SetDeviceType(deviceType models.DeviceType, owner string) (err error)

func (*Controller) SetFunction

func (this *Controller) SetFunction(function models.Function, owner string) error

func (*Controller) SetHub

func (this *Controller) SetHub(hub models.Hub, owner string) (err error)

func (*Controller) SetLocation

func (this *Controller) SetLocation(location models.Location, owner string) error

func (*Controller) SetProtocol

func (this *Controller) SetProtocol(protocol models.Protocol, owner string) (err error)

func (*Controller) ValidateAspect

func (this *Controller) ValidateAspect(aspect models.Aspect) (err error, code int)

func (*Controller) ValidateAspectDelete

func (this *Controller) ValidateAspectDelete(id string) (err error, code int)

func (*Controller) ValidateCharacteristicDelete

func (this *Controller) ValidateCharacteristicDelete(id string) (err error, code int)

func (*Controller) ValidateCharacteristics

func (this *Controller) ValidateCharacteristics(characteristic models.Characteristic) (err error, code int)

func (*Controller) ValidateConcept

func (this *Controller) ValidateConcept(concept models.Concept) (err error, code int)

func (*Controller) ValidateConceptDelete

func (this *Controller) ValidateConceptDelete(id string) (err error, code int)

func (*Controller) ValidateContent

func (this *Controller) ValidateContent(content models.Content, protocol models.Protocol, options model.ValidationOptions) (err error, code int)

func (*Controller) ValidateDevice

func (this *Controller) ValidateDevice(device models.Device) (err error, code int)

func (*Controller) ValidateDeviceClass

func (this *Controller) ValidateDeviceClass(deviceClass models.DeviceClass) (err error, code int)

func (*Controller) ValidateDeviceClassDelete

func (this *Controller) ValidateDeviceClassDelete(id string) (err error, code int)

func (*Controller) ValidateDeviceGroup

func (this *Controller) ValidateDeviceGroup(group models.DeviceGroup) (err error, code int)

func (*Controller) ValidateDeviceGroupSelection

func (this *Controller) ValidateDeviceGroupSelection(criteria []models.DeviceGroupFilterCriteria, devices []string) (error, int)

func (*Controller) ValidateDeviceType

func (this *Controller) ValidateDeviceType(dt models.DeviceType, options model.ValidationOptions) (err error, code int)

func (*Controller) ValidateFunction

func (this *Controller) ValidateFunction(function models.Function) (err error, code int)

func (*Controller) ValidateFunctionDelete

func (this *Controller) ValidateFunctionDelete(id string) (err error, code int)

func (*Controller) ValidateHub

func (this *Controller) ValidateHub(hub models.Hub) (err error, code int)

func (*Controller) ValidateListSubVariables

func (this *Controller) ValidateListSubVariables(variables []models.ContentVariable, serialization models.Serialization, options model.ValidationOptions) (err error, code int)

func (*Controller) ValidateLocation

func (this *Controller) ValidateLocation(location models.Location) (err error, code int)

func (*Controller) ValidateProtocol

func (this *Controller) ValidateProtocol(protocol models.Protocol) (err error, code int)

func (*Controller) ValidateService

func (this *Controller) ValidateService(service models.Service, protocolCache *map[string]models.Protocol, options model.ValidationOptions) (error, int)

func (*Controller) ValidateStructureSubVariables

func (this *Controller) ValidateStructureSubVariables(variables []models.ContentVariable, serialization models.Serialization, options model.ValidationOptions) (err error, code int)

func (*Controller) ValidateVariable

func (this *Controller) ValidateVariable(variable models.ContentVariable, serialization models.Serialization, options model.ValidationOptions) (err error, code int)

type ErrorProducer

type ErrorProducer struct{}

func (ErrorProducer) PublishAspectDelete

func (this ErrorProducer) PublishAspectDelete(id string, owner string) (err error)

func (ErrorProducer) PublishAspectUpdate

func (this ErrorProducer) PublishAspectUpdate(aspect models.Aspect, owner string) (err error)

func (ErrorProducer) PublishDeviceDelete

func (this ErrorProducer) PublishDeviceDelete(id string, owner string) (err error)

func (ErrorProducer) PublishHub

func (this ErrorProducer) PublishHub(hub models.Hub) (err error)

type Producer

type Producer interface {
	PublishDeviceDelete(id string, owner string) error
	PublishHub(hub models.Hub) (err error)
	PublishAspectDelete(id string, owner string) error
	PublishAspectUpdate(aspect models.Aspect, owner string) error
}

type Security

type Security interface {
	CheckBool(token string, kind string, id string, action model.AuthAction) (allowed bool, err error)
	CheckMultiple(token string, kind string, ids []string, action model.AuthAction) (map[string]bool, error)
}

Jump to

Keyboard shortcuts

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