dtos

package
v0.1.67 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 3 Imported by: 34

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoEventDTOsToModels added in v0.1.67

func AutoEventDTOsToModels(autoEventDTOs []AutoEvent) []models.AutoEvent

AutoEventDTOsToModels transforms the AutoEvent DTO array to the AutoEvent model array

func ProtocolDTOsToModels added in v0.1.67

func ProtocolDTOsToModels(protocolDTOs map[string]ProtocolProperties) map[string]models.ProtocolProperties

ProtocolDTOsToModels transforms the Protocol DTO map to the Protocol model map

func ToAutoEventModel added in v0.1.67

func ToAutoEventModel(a AutoEvent) models.AutoEvent

ToAutoEventModel transforms the AutoEvent DTO to the AutoEvent model

func ToCommandModel added in v0.1.67

func ToCommandModel(c Command) models.Command

ToCommandModel transforms the Command DTO to the Command model

func ToDeviceResourceModel added in v0.1.67

func ToDeviceResourceModel(d DeviceResource) models.DeviceResource

ToDeviceResourceModel transforms the DeviceResource DTO to the DeviceResource model

func ToProfileResourceModel added in v0.1.67

func ToProfileResourceModel(p ProfileResource) models.ProfileResource

ToProfileResourceModel transforms the ProfileResource DTO to the ProfileResource model

func ToPropertyValueModel added in v0.1.67

func ToPropertyValueModel(p PropertyValue) models.PropertyValue

ToPropertyValueModel transforms the PropertyValue DTO to the PropertyValue model

func ToProtocolPropertiesModel added in v0.1.67

func ToProtocolPropertiesModel(p ProtocolProperties) models.ProtocolProperties

ToPropertyValueModel transforms the ProtocolProperties DTO to the ProtocolProperties model

func ToReadingModel

func ToReadingModel(r BaseReading, device string) models.Reading

Convert Reading DTO to Reading model

func ToResourceOperationModel added in v0.1.67

func ToResourceOperationModel(ro ResourceOperation) models.ResourceOperation

ToResourceOperationModel transforms the ResourceOperation DTO to the ResourceOperation model

Types

type AutoEvent added in v0.1.67

type AutoEvent struct {
	// Frequency indicates how often the specific resource needs to be polled.
	// It represents as a duration string.
	// The format of this field is to be an unsigned integer followed by a unit which may be "ms", "s", "m" or "h"
	// representing milliseconds, seconds, minutes or hours. Eg, "100ms", "24h"
	Frequency string `json:"frequency" validate:"required,autoevent-frequency"`
	// OnChange indicates whether the device service will generate an event only,
	// if the reading value is different from the previous one.
	// If true, only generate events when readings change
	OnChange bool `json:"onChange,omitempty"`
	// Resource indicates the name of the resource in the device profile which describes the event to generate
	Resource string `json:"resource" validate:"required"`
}

AutoEvent supports auto-generated events sourced from a device service This object and its properties correspond to the AutoEvent object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/AutoEvent

type BaseReading

type BaseReading struct {
	common.Versionable `json:",inline"`
	Id                 string   `json:"id"`
	Pushed             int64    `json:"pushed,omitempty"`
	Created            int64    `json:"created"`
	Origin             int64    `json:"origin"`
	Modified           int64    `json:"modified,omitempty"`
	DeviceName         string   `json:"deviceName"`
	Name               string   `json:"name"`
	Labels             []string `json:"labels,omitempty"`
	BinaryReading      `json:",inline"`
	SimpleReading      `json:",inline"`
}

BaseReading defines the content of a reading object (usually generated by a device service) which can contain a SimpleReading or a BinaryReading (but not both). This object and its properties correspond to the BaseReading object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BaseReading

func FromReadingModelToDTO added in v0.1.65

func FromReadingModelToDTO(reading models.Reading) BaseReading

type BinaryReading

type BinaryReading struct {
	BinaryValue []byte `json:"binaryValue" validate:"required"`
	MediaType   string `json:"mediaType" validate:"required"`
}

BinaryReading defines the content of the binary form of a reading object (usually generated by a device service) This object and its properties correspond to the BinaryReading object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BinaryReading

type Command added in v0.1.67

type Command struct {
	Id   string `json:"id" yaml:"id,omitempty"`                                   // Id is a unique identifier, such as a UUID
	Name string `json:"name" yaml:"name" validate:"required"`                     // Command name (unique on the profile)
	Get  bool   `json:"get" yaml:"get,omitempty" validate:"required_without=Put"` // Get Command enabled
	Put  bool   `json:"put" yaml:"put,omitempty" validate:"required_without=Get"` // Put Command enabled
}

Command defines a specific read/write operation targeting a device This object and its properties correspond to the Command object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/Command

type Device added in v0.1.67

type Device struct {
	Id             string                        `json:"id,omitempty"`
	Created        int64                         `json:"created,omitempty"`
	Modified       int64                         `json:"modified,omitempty"`
	Name           string                        `json:"name" validate:"required"`
	Description    string                        `json:"description,omitempty"`
	AdminState     string                        `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"`
	OperatingState string                        `json:"operatingState" validate:"oneof='ENABLED' 'DISABLED'"`
	LastConnected  int64                         `json:"lastConnected,omitempty"`
	LastReported   int64                         `json:"lastReported,omitempty"`
	Labels         []string                      `json:"labels,omitempty"`
	Location       interface{}                   `json:"location,omitempty"`
	ServiceName    string                        `json:"serviceName" validate:"required"`
	ProfileName    string                        `json:"profileName" validate:"required"`
	AutoEvents     []AutoEvent                   `json:"autoEvents,omitempty" validate:"dive"`
	Protocols      map[string]ProtocolProperties `json:"protocols,omitempty" validate:"required,gt=0"`
}

Device represents a registered device participating within the EdgeX Foundry ecosystem This object and its properties correspond to the Device object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/Device

type DeviceProfile added in v0.1.67

type DeviceProfile struct {
	Id              string            `json:"id,omitempty"`
	Name            string            `json:"name" yaml:"name" validate:"required" `
	Manufacturer    string            `json:"manufacturer,omitempty" yaml:"manufacturer,omitempty"`
	Description     string            `json:"description,omitempty" yaml:"description,omitempty"`
	Model           string            `json:"model,omitempty" yaml:"model,omitempty"`
	Labels          []string          `json:"labels,omitempty" yaml:"labels,flow,omitempty"`
	DeviceResources []DeviceResource  `json:"deviceResources" yaml:"deviceResources" validate:"required,gt=0,dive"`
	DeviceCommands  []ProfileResource `json:"deviceCommands,omitempty" yaml:"deviceCommands,omitempty" validate:"dive"`
	CoreCommands    []Command         `json:"coreCommands,omitempty" yaml:"coreCommands,omitempty" validate:"dive"`
}

DeviceProfile represents the attributes and operational capabilities of a device. It is a template for which there can be multiple matching devices within a given system. This object and its properties correspond to the DeviceProfile object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceProfile

type DeviceResource added in v0.1.67

type DeviceResource struct {
	Description string            `json:"description" yaml:"description,omitempty"`
	Name        string            `json:"name" yaml:"name,omitempty" validate:"required"`
	Tag         string            `json:"tag" yaml:"tag,omitempty"`
	Properties  PropertyValue     `json:"properties" yaml:"properties"`
	Attributes  map[string]string `json:"attributes" yaml:"attributes,omitempty"`
}

DeviceResource represents a value on a device that can be read or written This object and its properties correspond to the DeviceResource object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceResource

type DeviceService added in v0.1.67

type DeviceService struct {
	Id             string   `json:"id,omitempty"`
	Name           string   `json:"name" validate:"required"`
	Created        int64    `json:"created,omitempty"`
	Modified       int64    `json:"modified,omitempty"`
	Description    string   `json:"description,omitempty"`
	LastConnected  int64    `json:"lastConnected,omitempty"`
	LastReported   int64    `json:"lastReported,omitempty"`
	OperatingState string   `json:"operatingState" validate:"oneof='ENABLED' 'DISABLED'"`
	Labels         []string `json:"labels,omitempty"`
	BaseAddress    string   `json:"baseAddress" validate:"required,uri"`
	AdminState     string   `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"`
}

DeviceService represents a service that is responsible for proxying connectivity between a set of devices and the EdgeX Foundry core services. This object and its properties correspond to the DeviceService object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceService

type Event added in v0.1.65

type Event struct {
	common.Versionable `json:",inline"`
	ID                 string        `json:"id"`
	Pushed             int64         `json:"pushed,omitempty"`
	DeviceName         string        `json:"deviceName"`
	Created            int64         `json:"created"`
	Modified           int64         `json:"modified,omitempty"`
	Origin             int64         `json:"origin"`
	Readings           []BaseReading `json:"readings"`
}

Event represents a single measurable event read from a device This object and its properties correspond to the Event object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/Event

func FromEventModelToDTO added in v0.1.65

func FromEventModelToDTO(event models.Event) Event

type ProfileResource added in v0.1.67

type ProfileResource struct {
	Name string              `json:"name,omitempty" yaml:"name,omitempty" validate:"required"`
	Get  []ResourceOperation `json:"get,omitempty" yaml:"get,omitempty" validate:"required_without=Set"`
	Set  []ResourceOperation `json:"set,omitempty" yaml:"set,omitempty" validate:"required_without=Get"`
}

ProfileResource defines read/write capabilities native to the device This object and its properties correspond to the ProfileResource object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ProfileResource

type PropertyValue added in v0.1.67

type PropertyValue struct {
	Type          string `json:"type" yaml:"type" validate:"required"`
	ReadWrite     string `json:"readWrite,omitempty" yaml:"readWrite,omitempty"`
	Units         string `json:"units,omitempty" yaml:"units,omitempty"`
	Minimum       string `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	Maximum       string `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	DefaultValue  string `json:"defaultValue,omitempty" yaml:"defaultValue,omitempty"`
	Mask          string `json:"mask,omitempty" yaml:"mask,omitempty"`
	Shift         string `json:"shift,omitempty" yaml:"shift,omitempty"`
	Scale         string `json:"scale,omitempty" yaml:"scale,omitempty"`
	Offset        string `json:"offset,omitempty" yaml:"offset,omitempty"`
	Base          string `json:"base,omitempty" yaml:"base,omitempty"`
	Assertion     string `json:"assertion,omitempty" yaml:"assertion,omitempty"`
	FloatEncoding string `json:"floatEncoding,omitempty" yaml:"floatEncoding,omitempty" validate:"omitempty,oneof='Base64' 'eNotation'"`
	MediaType     string `json:"mediaType,omitempty" yaml:"mediaType,omitempty"`
}

PropertyValue defines constraints with regard to the range of acceptable values assigned to an event reading and defined as a property within a device profile. This object and its properties correspond to the PropertyValue object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/PropertyValue

type ProtocolProperties added in v0.1.67

type ProtocolProperties map[string]string

ProtocolProperties contains the device connection information in key/value pair

type ResourceOperation added in v0.1.67

type ResourceOperation struct {
	DeviceResource string            `json:"deviceResource" yaml:"deviceResource" validate:"required"` // The replacement of Object field
	Parameter      string            `json:"parameter" yaml:"parameter,omitempty"`
	Mappings       map[string]string `json:"mappings" yaml:"mappings,omitempty"`
}

ResourceOperation defines an operation of which a device is capable This object and its properties correspond to the ResourceOperation object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ResourceOperation

type SimpleReading

type SimpleReading struct {
	Value         string `json:"value" validate:"required"`
	ValueType     string `json:"valueType" validate:"required"`
	FloatEncoding string `json:"floatEncoding,omitempty"`
}

SimpleReading defines the content of the simple reading object (usually generated by a device service) which can contain simple non-binary data types. This object and its properties correspond to the SimpleReading object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/SimpleReading

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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