controller

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 22 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

View Source
var ResourcesEffectedByUserDelete_BATCH_SIZE int64 = 1000

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 configuration.Config, db database.Database, p Publisher, permClient client.Client) (ctrl *Controller, err error)

func (*Controller) CreateDevice added in v0.1.53

func (this *Controller) CreateDevice(token string, device models.Device) (result models.Device, err error, code int)

func (*Controller) DeleteAspect

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

func (*Controller) DeleteCharacteristic

func (this *Controller) DeleteCharacteristic(token string, id string) (error, int)

func (*Controller) DeleteConcept

func (this *Controller) DeleteConcept(token string, id string) (error, int)

func (*Controller) DeleteDevice

func (this *Controller) DeleteDevice(token string, id string) (error, int)

func (*Controller) DeleteDeviceClass

func (this *Controller) DeleteDeviceClass(token string, id string) (error, int)

func (*Controller) DeleteDeviceGroup

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

func (*Controller) DeleteDeviceType

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

func (*Controller) DeleteFunction

func (this *Controller) DeleteFunction(token string, id string) (error, int)

func (*Controller) DeleteHub

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

func (*Controller) DeleteLocation

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

func (*Controller) DeleteProtocol

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

func (*Controller) DeleteUser added in v0.1.53

func (this *Controller) DeleteUser(adminToken string, userId string) (err error, errCode int)

func (*Controller) DeviceIdToGeneratedDeviceGroupId added in v0.1.20

func (this *Controller) DeviceIdToGeneratedDeviceGroupId(deviceId string) string

func (*Controller) EnsureGeneratedDeviceGroup added in v0.1.53

func (this *Controller) EnsureGeneratedDeviceGroup(device models.Device) (err error)

func (*Controller) EnsureInitialRights added in v0.1.15

func (this *Controller) EnsureInitialRights(topic string, resourceId string, owner string) error

func (*Controller) Export added in v0.1.53

func (this *Controller) Export(token string, options model.ImportExportOptions) (result model.ImportExport, err error, code int)

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) GetCharacteristics added in v0.1.15

func (this *Controller) GetCharacteristics(leafsOnly bool) (result []models.Characteristic, err error, code 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) GetLocation

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

func (*Controller) GetPermissionsClient added in v0.1.15

func (c *Controller) GetPermissionsClient() client.Client

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) Import added in v0.1.53

func (this *Controller) Import(token string, importModel model.ImportExport, options model.ImportExportOptions) (err error, code int)

func (*Controller) ListAspectNodes added in v0.1.40

func (this *Controller) ListAspectNodes(listOptions model.AspectListOptions) (result []models.AspectNode, total int64, err error, errCode int)

func (*Controller) ListAspects added in v0.1.40

func (this *Controller) ListAspects(listOptions model.AspectListOptions) (result []models.Aspect, total int64, err error, errCode int)

func (*Controller) ListCharacteristics added in v0.1.48

func (this *Controller) ListCharacteristics(listOptions model.CharacteristicListOptions) (result []models.Characteristic, total int64, err error, errCode int)

func (*Controller) ListConcepts added in v0.1.41

func (this *Controller) ListConcepts(listOptions model.ConceptListOptions) (result []models.Concept, total int64, err error, errCode int)

func (*Controller) ListConceptsWithCharacteristics added in v0.1.41

func (this *Controller) ListConceptsWithCharacteristics(listOptions model.ConceptListOptions) (result []models.ConceptWithCharacteristics, total int64, err error, errCode int)

func (*Controller) ListDeviceClasses added in v0.1.43

func (this *Controller) ListDeviceClasses(listOptions model.DeviceClassListOptions) (result []models.DeviceClass, total int64, err error, errCode int)

func (*Controller) ListDeviceGroups added in v0.1.25

func (this *Controller) ListDeviceGroups(token string, options model.DeviceGroupListOptions) (result []models.DeviceGroup, total int64, 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) ListDeviceTypesV3 added in v0.1.12

func (this *Controller) ListDeviceTypesV3(token string, listOptions model.DeviceTypeListOptions) (result []models.DeviceType, total int64, err error, errCode int)

func (*Controller) ListDevices added in v0.0.20

func (this *Controller) ListDevices(token string, options model.DeviceListOptions) (result []models.Device, err error, errCode int)

func (*Controller) ListExtendedDevices added in v0.1.0

func (this *Controller) ListExtendedDevices(token string, options model.ExtendedDeviceListOptions) (result []models.ExtendedDevice, total int64, err error, errCode int)

func (*Controller) ListExtendedHubs added in v0.1.0

func (this *Controller) ListExtendedHubs(token string, options model.HubListOptions) (result []models.ExtendedHub, total int64, err error, errCode int)

func (*Controller) ListFunctions added in v0.1.38

func (this *Controller) ListFunctions(options model.FunctionListOptions) (result []models.Function, total int64, 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) ListHubs added in v0.1.0

func (this *Controller) ListHubs(token string, options model.HubListOptions) (result []models.Hub, err error, errCode int)

func (*Controller) ListLocations added in v0.1.30

func (this *Controller) ListLocations(token string, options model.LocationListOptions) (result []models.Location, total int64, 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) 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(ownerId string, 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) ReadExtendedDevice added in v0.1.0

func (this *Controller) ReadExtendedDevice(id string, token string, action model.AuthAction, fullDt bool) (result models.ExtendedDevice, err error, errCode int)

func (*Controller) ReadExtendedDeviceByLocalId added in v0.1.0

func (this *Controller) ReadExtendedDeviceByLocalId(ownerId string, localId string, token string, action model.AuthAction, fullDt bool) (result models.ExtendedDevice, err error, errCode int)

func (*Controller) ReadExtendedHub added in v0.1.0

func (this *Controller) ReadExtendedHub(id string, token string, action model.AuthAction) (result models.ExtendedHub, 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) RemoveGeneratedDeviceGroup added in v0.1.18

func (this *Controller) RemoveGeneratedDeviceGroup(deviceid string, owner string) error

func (*Controller) RemoveRights added in v0.1.15

func (this *Controller) RemoveRights(topic string, id string) error

func (*Controller) SetAspect

func (this *Controller) SetAspect(token string, aspect models.Aspect) (result models.Aspect, err error, code int)

func (*Controller) SetCharacteristic

func (this *Controller) SetCharacteristic(token string, characteristic models.Characteristic) (result models.Characteristic, err error, code int)

func (*Controller) SetConcept

func (this *Controller) SetConcept(token string, concept models.Concept) (result models.Concept, err error, code int)

func (*Controller) SetDevice

func (this *Controller) SetDevice(token string, device models.Device, options model.DeviceUpdateOptions) (result models.Device, err error, code int)

func (*Controller) SetDeviceClass

func (this *Controller) SetDeviceClass(token string, class models.DeviceClass) (result models.DeviceClass, err error, code int)

func (*Controller) SetDeviceConnectionState added in v0.1.0

func (this *Controller) SetDeviceConnectionState(token string, id string, connected bool) (error, int)

func (*Controller) SetDeviceGroup

func (this *Controller) SetDeviceGroup(token string, dg models.DeviceGroup) (result models.DeviceGroup, err error, errCode int)

func (*Controller) SetDeviceType

func (this *Controller) SetDeviceType(token string, dt models.DeviceType, options model.DeviceTypeUpdateOptions) (models.DeviceType, error, int)

func (*Controller) SetFunction

func (this *Controller) SetFunction(token string, function models.Function) (result models.Function, err error, code int)

func (*Controller) SetHub

func (this *Controller) SetHub(token string, hub models.Hub) (result models.Hub, err error, code int)

func (*Controller) SetHubConnectionState added in v0.1.0

func (this *Controller) SetHubConnectionState(token string, id string, connected bool) (error, int)

func (*Controller) SetLocation

func (this *Controller) SetLocation(token string, location models.Location) (result models.Location, err error, errCode int)

func (*Controller) SetProtocol

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

func (*Controller) StartSyncLoop added in v0.1.53

func (this *Controller) StartSyncLoop(ctx context.Context, interval time.Duration, lockduration time.Duration)

func (*Controller) Sync added in v0.1.53

func (this *Controller) Sync(lockduration time.Duration) (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(token string, 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(token string, group models.DeviceGroup) (err error, code int)

func (*Controller) ValidateDeviceGroupDelete added in v0.1.18

func (this *Controller) ValidateDeviceGroupDelete(token string, id string) (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) ValidateDistinctDeviceTypeAttributes added in v0.1.53

func (this *Controller) ValidateDistinctDeviceTypeAttributes(devicetype models.DeviceType, attributeKeys []string) error

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(token string, hub models.Hub) (err error, code int)

func (*Controller) ValidateHubDevices added in v0.0.18

func (this *Controller) ValidateHubDevices(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 KeycloakClaims added in v0.1.53

type KeycloakClaims struct {
	RealmAccess map[string][]string `json:"realm_access"`
	gojwt.StandardClaims
}

type Publisher added in v0.1.53

type Publisher interface {
	PublishDevice(device models.Device) (err error)
	PublishDeviceDelete(id string) error

	PublishDeviceType(device models.DeviceType) (err error)
	PublishDeviceTypeDelete(id string) error

	PublishDeviceGroup(dg models.DeviceGroup) (err error)
	PublishDeviceGroupDelete(id string) error

	PublishProtocol(device models.Protocol) (err error)
	PublishProtocolDelete(id string) error

	PublishHub(hub models.Hub) (err error)
	PublishHubDelete(id string) error

	PublishConcept(concept models.Concept) (err error)
	PublishConceptDelete(id string) error

	PublishCharacteristic(characteristic models.Characteristic) (err error)
	PublishCharacteristicDelete(id string) error

	PublishAspect(device models.Aspect) (err error)
	PublishAspectDelete(id string) error

	PublishFunction(device models.Function) (err error)
	PublishFunctionDelete(id string) error

	PublishDeviceClass(device models.DeviceClass) (err error)
	PublishDeviceClassDelete(id string) error

	PublishLocation(device models.Location) (err error)
	PublishLocationDelete(id string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳