models

package
v0.0.0-...-7b61fee Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2019 Dell Technologies Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. * ******************************************************************************

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addressable

type Addressable struct {
	Created    int64         `bson:"created"`
	Modified   int64         `bson:"modified"`
	Origin     int64         `bson:"origin"`
	Id         bson.ObjectId `bson:"_id,omitempty"`
	Uuid       string        `bson:"uuid,omitempty"`
	Name       string        `bson:"name"`
	Protocol   string        `bson:"protocol"`  // Protocol for the address (HTTP/TCP)
	HTTPMethod string        `bson:"method"`    // Method for connecting (i.e. POST)
	Address    string        `bson:"address"`   // Address of the addressable
	Port       int           `bson:"port"`      // Port for the address
	Path       string        `bson:"path"`      // Path for callbacks
	Publisher  string        `bson:"publisher"` // For message bus protocols
	User       string        `bson:"user"`      // User id for authentication
	Password   string        `bson:"password"`  // Password of the user for authentication for the addressable
	Topic      string        `bson:"topic"`     // Topic for message bus addressables
}

func (*Addressable) FromContract

func (a *Addressable) FromContract(from contract.Addressable) (id string, err error)

func (*Addressable) TimestampForAdd

func (a *Addressable) TimestampForAdd()

func (*Addressable) TimestampForUpdate

func (a *Addressable) TimestampForUpdate()

func (*Addressable) ToContract

func (a *Addressable) ToContract() (c contract.Addressable)

type Channel

type Channel struct {
	Type          contract.ChannelType `bson:"type,omitempty"`
	MailAddresses []string             `bson:"mailAddresses,omitempty"`
	Url           string               `bson:"url,omitempty"`
}

func (*Channel) FromContract

func (channel *Channel) FromContract(from contract.Channel)

func (*Channel) ToContract

func (channel *Channel) ToContract() (c contract.Channel)

type Command

type Command struct {
	Created  int64         `bson:"created"`
	Modified int64         `bson:"modified"`
	Origin   int64         `bson:"origin"`
	Id       bson.ObjectId `bson:"_id,omitempty"`
	Uuid     string        `bson:"uuid,omitempty"`
	Name     string        `bson:"name"`
	Get      *Get          `bson:"get"`
	Put      *Put          `bson:"put"`
}

func (*Command) FromContract

func (c *Command) FromContract(from contract.Command) (contractId string, err error)

func (*Command) TimestampForAdd

func (c *Command) TimestampForAdd()

func (*Command) TimestampForUpdate

func (c *Command) TimestampForUpdate()

func (*Command) ToContract

func (c *Command) ToContract() (cmd contract.Command)

type Device

type Device struct {
	Created        int64                   `bson:"created"`
	Modified       int64                   `bson:"modified"`
	Origin         int64                   `bson:"origin"`
	Description    string                  `bson:"description"`
	Id             bson.ObjectId           `bson:"_id,omitempty"`
	Uuid           string                  `bson:"uuid,omitempty"`
	Protocols      string                  `bson:"protocols,omitempty"`  //Contains a JSON representation of the supported protocols for the device
	AutoEvents     string                  `bson:"autoEvents,omitempty"` //Contains a JSON representation of the device's auto-generated events
	Name           string                  `bson:"name"`                 // Unique name for identifying a device
	AdminState     contract.AdminState     `bson:"adminState"`           // Admin state (locked/unlocked)
	OperatingState contract.OperatingState `bson:"operatingState"`       // Operating state (enabled/disabled)
	Addressable    mgo.DBRef               `bson:"addressable"`          // Addressable for the device - stores information about it's address
	LastConnected  int64                   `bson:"lastConnected"`        // Time (milliseconds) that the device last provided any feedback or responded to any request
	LastReported   int64                   `bson:"lastReported"`         // Time (milliseconds) that the device reported data to the core microservice
	Labels         []string                `bson:"labels"`               // Other labels applied to the device to help with searching
	Location       interface{}             `bson:"location"`             // Device service specific location (interface{} is an empty interface so it can be anything)
	Service        mgo.DBRef               `bson:"service"`              // Associated Device Service - One per device
	Profile        mgo.DBRef               `bson:"profile"`              // Associated Device Profile - Describes the device
}

* This file is the model for the Device object in EdgeX * * * Device struct

func (*Device) FromContract

func (d *Device) FromContract(from contract.Device, dsTransform deviceServiceTransform, dpTransform deviceProfileTransform, cTransform commandTransform, aTransform addressableTransform) (id string, err error)

func (*Device) TimestampForAdd

func (d *Device) TimestampForAdd()

func (*Device) TimestampForUpdate

func (d *Device) TimestampForUpdate()

func (*Device) ToContract

func (d *Device) ToContract(dsTransform deviceServiceTransform, dpTransform deviceProfileTransform, cTransform commandTransform, aTransform addressableTransform) (c contract.Device, err error)

type DeviceProfile

type DeviceProfile struct {
	Created         int64             `bson:"created"`
	Modified        int64             `bson:"modified"`
	Origin          int64             `bson:"origin"`
	Description     string            `bson:"description"`
	Id              bson.ObjectId     `bson:"_id,omitempty"`
	Uuid            string            `bson:"uuid,omitempty"`
	Name            string            `bson:"name"`
	Manufacturer    string            `bson:"manufacturer"`
	Model           string            `bson:"model"`
	Labels          []string          `bson:"labels"`
	DeviceResources []DeviceResource  `bson:"deviceResources"`
	Resources       []ProfileResource `bson:"resources"`
	Commands        []mgo.DBRef       `bson:"commands"`
}

func (*DeviceProfile) FromContract

func (dp *DeviceProfile) FromContract(from contract.DeviceProfile, transform commandTransform) (contractId string, err error)

func (*DeviceProfile) TimestampForAdd

func (dp *DeviceProfile) TimestampForAdd()

func (*DeviceProfile) TimestampForUpdate

func (dp *DeviceProfile) TimestampForUpdate()

func (*DeviceProfile) ToContract

func (dp *DeviceProfile) ToContract(transform commandTransform) (c contract.DeviceProfile, err error)

type DeviceResource

type DeviceResource struct {
	Description string                 `bson:"description"`
	Name        string                 `bson:"name"`
	Tag         string                 `bson:"tag"`
	Properties  ProfileProperty        `bson:"properties"`
	Attributes  map[string]interface{} `bson:"attributes"`
}

type DeviceService

type DeviceService struct {
	Service    `bson:",inline"`
	AdminState contract.AdminState `bson:"adminState"` // Device Service Admin State
}

func (*DeviceService) FromContract

func (ds *DeviceService) FromContract(from contract.DeviceService, transform addressableTransform) (id string, err error)

func (*DeviceService) ToContract

func (ds *DeviceService) ToContract(transform addressableTransform) (c contract.DeviceService, err error)

type EncryptionDetails

type EncryptionDetails struct {
	Algo       string `bson:"encryptionAlgorithm,omitempty"`
	Key        string `bson:"encryptionKey,omitempty"`
	InitVector string `bson:"initializingVector,omitempty"`
}

type Filter

type Filter struct {
	DeviceIDs          []string `bson:"deviceIdentifiers,omitempty"`
	ValueDescriptorIDs []string `bson:"valueDescriptorIdentifiers,omitempty"`
}

type Get

type Get struct {
	Path      string     `bson:"path"`      // path used by service for action on a device or sensor
	Responses []Response `bson:"responses"` // responses from get or put requests to service
	URL       string     // url for requests from command service
}

type Interval

type Interval struct {
	Created   int64         `bson:"created"`
	Modified  int64         `bson:"modified"`
	Origin    int64         `bson:"origin"`
	Id        bson.ObjectId `bson:"_id,omitempty"`
	Uuid      string        `bson:"uuid,omitempty"`
	Name      string        `bson:"name"`
	Start     string        `bson:"start"`
	End       string        `bson:"end"`
	Frequency string        `bson:"frequency"`
	Cron      string        `bson:"cron,omitempty"`
	RunOnce   bool          `bson:"runonce"`
}

func (*Interval) FromContract

func (in *Interval) FromContract(from contract.Interval) (id string, err error)

func (*Interval) TimestampForAdd

func (in *Interval) TimestampForAdd()

func (*Interval) TimestampForUpdate

func (in *Interval) TimestampForUpdate()

func (*Interval) ToContract

func (in *Interval) ToContract() (c contract.Interval)

type IntervalAction

type IntervalAction struct {
	Created    int64         `bson:"created"`
	Modified   int64         `bson:"modified"`
	Origin     int64         `bson:"origin"`
	Id         bson.ObjectId `bson:"_id,omitempty"`
	Uuid       string        `bson:"uuid,omitempty"`
	Name       string        `bson:"name"`
	Interval   string        `bson:"interval"`
	Parameters string        `bson:"parameters"`
	Target     string        `bson:"target"`
	Protocol   string        `bson:"protocol"`
	HTTPMethod string        `bson:"httpMethod"`
	Address    string        `bson:"address"`
	Port       int           `bson:"port"`
	Path       string        `bson:"path"`
	Publisher  string        `bson:"publisher"`
	User       string        `bson:"user"`
	Password   string        `bson:"password"`
	Topic      string        `bson:"topic"`
}

func (*IntervalAction) FromContract

func (ia *IntervalAction) FromContract(from contract.IntervalAction) (id string, err error)

func (*IntervalAction) TimestampForAdd

func (ia *IntervalAction) TimestampForAdd()

func (*IntervalAction) TimestampForUpdate

func (ia *IntervalAction) TimestampForUpdate()

func (*IntervalAction) ToContract

func (ia *IntervalAction) ToContract() (c contract.IntervalAction)

type Notification

type Notification struct {
	Created     int64                          `bson:"created"`
	Modified    int64                          `bson:"modified"`
	Origin      int64                          `bson:"origin"`
	Id          bson.ObjectId                  `bson:"_id,omitempty"`
	Uuid        string                         `bson:"uuid,omitempty"`
	Slug        string                         `bson:"slug"`
	Sender      string                         `bson:"sender"`
	Category    contract.NotificationsCategory `bson:"category"`
	Severity    contract.NotificationsSeverity `bson:"severity"`
	Content     string                         `bson:"content"`
	Description string                         `bson:"description"`
	Status      contract.NotificationsStatus   `bson:"status"`
	Labels      []string                       `bson:"labels,omitempty"`
	ContentType string                         `bson:"contenttype"`
}

func (*Notification) FromContract

func (n *Notification) FromContract(from contract.Notification) (id string, err error)

func (*Notification) TimestampForAdd

func (n *Notification) TimestampForAdd()

func (*Notification) TimestampForUpdate

func (n *Notification) TimestampForUpdate()

func (*Notification) ToContract

func (n *Notification) ToContract() (c contract.Notification)

type ProfileProperty

type ProfileProperty struct {
	Value PropertyValue `bson:"value"`
	Units Units         `bson:"units"`
}

type ProfileResource

type ProfileResource struct {
	Name string              `bson:"name"`
	Get  []ResourceOperation `bson:"get"`
	Set  []ResourceOperation `bson:"set"`
}

type PropertyValue

type PropertyValue struct {
	Type         string `bson:"type"`         // ValueDescriptor Type of property after transformations
	ReadWrite    string `bson:"readWrite"`    // Read/Write Permissions set for this property
	Minimum      string `bson:"minimum"`      // Minimum value that can be get/set from this property
	Maximum      string `bson:"maximum"`      // Maximum value that can be get/set from this property
	DefaultValue string `bson:"defaultValue"` // Default value set to this property if no argument is passed
	Size         string `bson:"size"`         // Size of this property in its type  (i.e. bytes for numeric types, characters for string types)
	Mask         string `bson:"mask"`         // Mask to be applied prior to get/set of property
	Shift        string `bson:"shift"`        // Shift to be applied after masking, prior to get/set of property
	Scale        string `bson:"scale"`        // Multiplicative factor to be applied after shifting, prior to get/set of property
	Offset       string `bson:"offset"`       // Additive factor to be applied after multiplying, prior to get/set of property
	Base         string `bson:"base"`         // Base for property to be applied to, leave 0 for no power operation (i.e. base ^ property: 2 ^ 10)
	Assertion    string `bson:"assertion"`    // Required value of the property, set for checking error state.  Failing an assertion condition will mark the device with an error state
	Precision    string `bson:"precision"`
}

type ProvisionWatcher

type ProvisionWatcher struct {
	Created        int64                   `bson:"created"`
	Modified       int64                   `bson:"modified"`
	Origin         int64                   `bson:"origin"`
	Id             bson.ObjectId           `bson:"_id,omitempty"`
	Uuid           string                  `bson:"uuid,omitempty"`
	Name           string                  `bson:"name"`           // unique name and identifier of the addressable
	Identifiers    map[string]string       `bson:"identifiers"`    // set of key value pairs that identify type of of address (MAC, HTTP,...) and address to watch for (00-05-1B-A1-99-99, 10.0.0.1,...)
	Profile        mgo.DBRef               `bson:"profile"`        // device profile that should be applied to the devices available at the identifier addresses
	Service        mgo.DBRef               `bson:"service"`        // device service that owns the watcher
	OperatingState contract.OperatingState `bson:"operatingState"` // operational state - either enabled or disabled
}

func (*ProvisionWatcher) FromContract

func (pw *ProvisionWatcher) FromContract(from contract.ProvisionWatcher, dpt deviceProfileTransform, dst deviceServiceTransform, ct commandTransform, at addressableTransform) (id string, err error)

func (*ProvisionWatcher) TimestampForAdd

func (pw *ProvisionWatcher) TimestampForAdd()

func (*ProvisionWatcher) TimestampForUpdate

func (pw *ProvisionWatcher) TimestampForUpdate()

func (*ProvisionWatcher) ToContract

func (pw *ProvisionWatcher) ToContract(dpt deviceProfileTransform, dst deviceServiceTransform, ct commandTransform, at addressableTransform) (c contract.ProvisionWatcher, err error)

type Put

type Put struct {
	Path           string     `bson:"path"`      // path used by service for action on a device or sensor
	Responses      []Response `bson:"responses"` // responses from get or put requests to service
	URL            string     // url for requests from command service
	ParameterNames []string   `bson:"parameterNames"`
}

type Registration

type Registration struct {
	Created     int64         `bson:"created"`
	Modified    int64         `bson:"modified"`
	Origin      int64         `bson:"origin"`
	ID          bson.ObjectId `bson:"_id,omitempty"`
	Uuid        string        `bson:"uuid,omitempty"`
	Name        string
	Addressable Addressable
	Format      string
	Filter      Filter
	Encryption  EncryptionDetails
	Compression string
	Enable      bool
	Destination string
}

func (*Registration) FromContract

func (r *Registration) FromContract(from contract.Registration) (id string, err error)

func (*Registration) TimestampForAdd

func (r *Registration) TimestampForAdd()

func (*Registration) TimestampForUpdate

func (r *Registration) TimestampForUpdate()

func (*Registration) ToContract

func (r *Registration) ToContract() (c contract.Registration)

type ResourceOperation

type ResourceOperation struct {
	Index     string            `bson:"index"`
	Operation string            `bson:"operation"`
	Object    string            `bson:"object"`
	Parameter string            `bson:"parameter"`
	Resource  string            `bson:"resource"`
	Secondary []string          `bson:"secondary"`
	Mappings  map[string]string `bson:"mappings"`
}

type Response

type Response struct {
	Code           string   `bson:"code"`
	Description    string   `bson:"description"`
	ExpectedValues []string `bson:"expectedValues"`
}

type Service

type Service struct {
	Created        int64                   `bson:"created"`
	Modified       int64                   `bson:"modified"`
	Origin         int64                   `bson:"origin"`
	Description    string                  `bson:"description"`
	Id             bson.ObjectId           `bson:"_id,omitempty"`
	Uuid           string                  `bson:"uuid,omitempty"`
	Name           string                  `bson:"name"`           // time in milliseconds that the device last provided any feedback or responded to any request
	LastConnected  int64                   `bson:"lastConnected"`  // time in milliseconds that the device last reported data to the core
	LastReported   int64                   `bson:"lastReported"`   // operational state - either enabled or disabled
	OperatingState contract.OperatingState `bson:"operatingState"` // operational state - ether enabled or disableddc
	Labels         []string                `bson:"labels"`         // tags or other labels applied to the device service for search or other identification needs
	Addressable    mgo.DBRef               `bson:"addressable"`    // address (MQTT topic, HTTP address, serial bus, etc.) for reaching the service
}

func (*Service) FromContract

func (s *Service) FromContract(from contract.Service, transform addressableTransform) (id string, err error)

func (*Service) TimestampForAdd

func (s *Service) TimestampForAdd()

func (*Service) TimestampForUpdate

func (s *Service) TimestampForUpdate()

func (*Service) ToContract

func (s *Service) ToContract(transform addressableTransform) (c contract.Service, err error)

type Subscription

type Subscription struct {
	Created              int64                            `bson:"created"`
	Modified             int64                            `bson:"modified"`
	Origin               int64                            `bson:"origin"`
	Id                   bson.ObjectId                    `bson:"_id,omitempty"`
	Uuid                 string                           `bson:"uuid,omitempty"`
	Slug                 string                           `bson:"slug"`
	Receiver             string                           `bson:"receiver"`
	Description          string                           `bson:"description"`
	SubscribedCategories []contract.NotificationsCategory `bson:"subscribedCategories,omitempty"`
	SubscribedLabels     []string                         `bson:"subscribedLabels,omitempty"`
	Channels             []Channel                        `bson:"channels,omitempty"`
}

* A subscription for notification alerts * * * Subscription struct

func (*Subscription) FromContract

func (s *Subscription) FromContract(from contract.Subscription) (id string, err error)

func (*Subscription) TimestampForAdd

func (s *Subscription) TimestampForAdd()

func (*Subscription) TimestampForUpdate

func (s *Subscription) TimestampForUpdate()

func (*Subscription) ToContract

func (s *Subscription) ToContract() (c contract.Subscription)

type Transmission

type Transmission struct {
	Created      int64                       `bson:"created"`
	Modified     int64                       `bson:"modified"`
	Origin       int64                       `bson:"origin"`
	Id           bson.ObjectId               `bson:"_id,omitempty"`
	Uuid         string                      `bson:"uuid,omitempty"`
	Notification Notification                `bson:"notification,omitempty"`
	Receiver     string                      `bson:"receiver"`
	Channel      Channel                     `bson:"channel,omitempty"`
	Status       contract.TransmissionStatus `bson:"status"`
	ResendCount  int                         `bson:"resendcount"`
	Records      []TransmissionRecord        `bson:"records,omitempty"`
}

func (*Transmission) FromContract

func (t *Transmission) FromContract(from contract.Transmission) (id string, err error)

func (*Transmission) TimestampForAdd

func (t *Transmission) TimestampForAdd()

func (*Transmission) TimestampForUpdate

func (t *Transmission) TimestampForUpdate()

func (*Transmission) ToContract

func (t *Transmission) ToContract() (c contract.Transmission)

type TransmissionRecord

type TransmissionRecord struct {
	Status   contract.TransmissionStatus `bson:"status"`
	Response string                      `bson:"response"`
	Sent     int64                       `bson:"sent"`
}

type Units

type Units struct {
	Type         string `bson:"type"`
	ReadWrite    string `bson:"readWrite"`
	DefaultValue string `bson:"defaultValue"`
}

Jump to

Keyboard shortcuts

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