Documentation ¶
Index ¶
- Constants
- func FromProtocolModelsToDTOs(protocolModels map[string]models.ProtocolProperties) map[string]ProtocolProperties
- func ToAutoEventModel(a AutoEvent) models.AutoEvent
- func ToAutoEventModels(autoEventDTOs []AutoEvent) []models.AutoEvent
- func ToCommandModel(c Command) models.Command
- func ToCommandModels(commandDTOs []Command) []models.Command
- func ToDeviceModel(dto Device) models.Device
- func ToDeviceProfileModel(deviceProfileDTO DeviceProfile) models.DeviceProfile
- func ToDeviceResourceModel(d DeviceResource) models.DeviceResource
- func ToDeviceResourceModels(deviceResourceDTOs []DeviceResource) []models.DeviceResource
- func ToDeviceServiceModel(dto DeviceService) models.DeviceService
- func ToProfileResourceModel(p ProfileResource) models.ProfileResource
- func ToProfileResourceModels(profileResourceDTOs []ProfileResource) []models.ProfileResource
- func ToPropertyValueModel(p PropertyValue) models.PropertyValue
- func ToProtocolModels(protocolDTOs map[string]ProtocolProperties) map[string]models.ProtocolProperties
- func ToProtocolPropertiesModel(p ProtocolProperties) models.ProtocolProperties
- func ToReadingModel(r BaseReading) models.Reading
- func ToResourceOperationModel(ro ResourceOperation) models.ResourceOperation
- type AutoEvent
- type BaseReading
- type BinaryReading
- type Command
- type Device
- type DeviceProfile
- type DeviceResource
- type DeviceService
- type Event
- type ProfileResource
- type PropertyValue
- type ProtocolProperties
- type ResourceOperation
- type SimpleReading
- type UpdateDevice
- type UpdateDeviceService
Constants ¶
const ( ValueTypeBool = "Bool" ValueTypeString = "String" ValueTypeUint8 = "Uint8" ValueTypeUint16 = "Uint16" ValueTypeUint32 = "Uint32" ValueTypeUint64 = "Uint64" ValueTypeInt8 = "Int8" ValueTypeInt16 = "Int16" ValueTypeInt32 = "Int32" ValueTypeInt64 = "Int64" ValueTypeFloat32 = "Float32" ValueTypeFloat64 = "Float64" ValueTypeBinary = "Binary" ValueTypeBoolArray = "BoolArray" ValueTypeStringArray = "StringArray" ValueTypeUint8Array = "Uint8Array" ValueTypeUint16Array = "Uint16Array" ValueTypeUint32Array = "Uint32Array" ValueTypeUint64Array = "Uint64Array" ValueTypeInt8Array = "Int8Array" ValueTypeInt16Array = "Int16Array" ValueTypeInt32Array = "Int32Array" ValueTypeInt64Array = "Int64Array" ValueTypeFloat32Array = "Float32Array" ValueTypeFloat64Array = "Float64Array" )
Constants related to Reading ValueTypes
Variables ¶
This section is empty.
Functions ¶
func FromProtocolModelsToDTOs ¶ added in v0.1.89
func FromProtocolModelsToDTOs(protocolModels map[string]models.ProtocolProperties) map[string]ProtocolProperties
FromProtocolModelsToDTOs transforms the Protocol model map to the Protocol DTO map
func ToAutoEventModel ¶ added in v0.1.67
ToAutoEventModel transforms the AutoEvent DTO to the AutoEvent model
func ToAutoEventModels ¶ added in v0.1.70
ToAutoEventModels transforms the AutoEvent DTO array to the AutoEvent model array
func ToCommandModel ¶ added in v0.1.67
ToCommandModel transforms the Command DTO to the Command model
func ToCommandModels ¶ added in v0.1.70
ToCommandModels transforms the Command DTOs to the Command models
func ToDeviceModel ¶ added in v0.1.89
ToDeviceModel transforms the Device DTO to the Device Model
func ToDeviceProfileModel ¶ added in v0.1.86
func ToDeviceProfileModel(deviceProfileDTO DeviceProfile) models.DeviceProfile
ToDeviceProfileModel transforms the DeviceProfile DTO to the DeviceProfile model
func ToDeviceResourceModel ¶ added in v0.1.67
func ToDeviceResourceModel(d DeviceResource) models.DeviceResource
ToDeviceResourceModel transforms the DeviceResource DTO to the DeviceResource model
func ToDeviceResourceModels ¶ added in v0.1.70
func ToDeviceResourceModels(deviceResourceDTOs []DeviceResource) []models.DeviceResource
ToDeviceResourceModels transforms the DeviceResource DTOs to the DeviceResource models
func ToDeviceServiceModel ¶ added in v0.1.89
func ToDeviceServiceModel(dto DeviceService) models.DeviceService
ToDeviceServiceModel transforms the DeviceService DTO to the DeviceService Model
func ToProfileResourceModel ¶ added in v0.1.67
func ToProfileResourceModel(p ProfileResource) models.ProfileResource
ToProfileResourceModel transforms the ProfileResource DTO to the ProfileResource model
func ToProfileResourceModels ¶ added in v0.1.70
func ToProfileResourceModels(profileResourceDTOs []ProfileResource) []models.ProfileResource
ToProfileResourceModels transforms the ProfileResource DTOs to the ProfileResource models
func ToPropertyValueModel ¶ added in v0.1.67
func ToPropertyValueModel(p PropertyValue) models.PropertyValue
ToPropertyValueModel transforms the PropertyValue DTO to the PropertyValue model
func ToProtocolModels ¶ added in v0.1.70
func ToProtocolModels(protocolDTOs map[string]ProtocolProperties) map[string]models.ProtocolProperties
ToProtocolModels transforms the Protocol DTO map to the Protocol model map
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) 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 string `json:"frequency" validate:"required,edgex-dto-autoevent-frequency"` OnChange bool `json:"onChange,omitempty"` Resource string `json:"resource" validate:"required"` }
AutoEvent and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/AutoEvent
func FromAutoEventModelToDTO ¶ added in v0.1.89
FromAutoEventModelToDTO transforms the AutoEvent model to the AutoEvent DTO
func FromAutoEventModelsToDTOs ¶ added in v0.1.89
ToAutoEventModels transforms the AutoEvent model array to the AutoEvent DTO array
type BaseReading ¶
type BaseReading struct { common.Versionable `json:",inline"` Id string `json:"id"` Created int64 `json:"created"` Origin int64 `json:"origin" validate:"required"` DeviceName string `json:"deviceName" validate:"required"` ResourceName string `json:"resourceName" validate:"required"` ProfileName string `json:"profileName" validate:"required"` ValueType string `json:"valueType" validate:"required"` BinaryReading `json:",inline" validate:"-"` SimpleReading `json:",inline" validate:"-"` }
BaseReading and its properties are defined 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
func (BaseReading) Validate ¶ added in v0.1.69
func (b BaseReading) Validate() error
Validate satisfies the Validator interface
type BinaryReading ¶
type BinaryReading struct { BinaryValue []byte `json:"binaryValue" validate:"gt=0,dive,required"` MediaType string `json:"mediaType" validate:"required"` }
BinaryReading and its properties are defined 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 { Name string `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string"` Get bool `json:"get" yaml:"get,omitempty" validate:"required_without=Put"` Put bool `json:"put" yaml:"put,omitempty" validate:"required_without=Get"` }
Command and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/Command
func FromCommandModelToDTO ¶ added in v0.1.86
FromCommandModelToDTO transforms the Command model to the Command DTO
func FromCommandModelsToDTOs ¶ added in v0.1.86
FromCommandModelsToDTOs transforms the Command models to the Command DTOs
type Device ¶ added in v0.1.67
type Device struct { common.Versionable `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` Created int64 `json:"created,omitempty"` Modified int64 `json:"modified,omitempty"` Name string `json:"name" validate:"required,edgex-dto-none-empty-string"` Description string `json:"description,omitempty"` AdminState string `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"` OperatingState string `json:"operatingState" validate:"oneof='UP' 'DOWN' 'UNKNOWN'"` 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,edgex-dto-none-empty-string"` ProfileName string `json:"profileName" validate:"required,edgex-dto-none-empty-string"` AutoEvents []AutoEvent `json:"autoEvents,omitempty" validate:"dive"` Protocols map[string]ProtocolProperties `json:"protocols,omitempty" validate:"required,gt=0"` }
Device and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/Device
func FromDeviceModelToDTO ¶ added in v0.1.89
FromDeviceModelToDTO transforms the Device Model to the Device DTO
type DeviceProfile ¶ added in v0.1.67
type DeviceProfile struct { common.Versionable `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` Name string `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string" ` 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 and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceProfile
func FromDeviceProfileModelToDTO ¶ added in v0.1.86
func FromDeviceProfileModelToDTO(deviceProfile models.DeviceProfile) DeviceProfile
FromDeviceProfileModelToDTO transforms the DeviceProfile Model to the DeviceProfile DTO
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,edgex-dto-none-empty-string"` Tag string `json:"tag" yaml:"tag,omitempty"` Properties PropertyValue `json:"properties" yaml:"properties"` Attributes map[string]string `json:"attributes" yaml:"attributes,omitempty"` }
DeviceResource and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceResource
func FromDeviceResourceModelToDTO ¶ added in v0.1.86
func FromDeviceResourceModelToDTO(d models.DeviceResource) DeviceResource
FromDeviceResourceModelToDTO transforms the DeviceResource model to the DeviceResource DTO
func FromDeviceResourceModelsToDTOs ¶ added in v0.1.86
func FromDeviceResourceModelsToDTOs(deviceResourceModels []models.DeviceResource) []DeviceResource
FromDeviceResourceModelsToDTOs transforms the DeviceResource models to the DeviceResource DTOs
type DeviceService ¶ added in v0.1.67
type DeviceService struct { common.Versionable `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` Name string `json:"name" validate:"required,edgex-dto-none-empty-string"` 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"` Labels []string `json:"labels,omitempty"` BaseAddress string `json:"baseAddress" validate:"required,uri"` AdminState string `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"` }
DeviceService and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceService
func FromDeviceServiceModelToDTO ¶ added in v0.1.89
func FromDeviceServiceModelToDTO(ds models.DeviceService) DeviceService
FromDeviceServiceModelToDTO transforms the DeviceService Model to the DeviceService DTO
type Event ¶ added in v0.1.65
type Event struct { common.Versionable `json:",inline"` Id string `json:"id" validate:"required,uuid"` Pushed int64 `json:"pushed,omitempty"` DeviceName string `json:"deviceName" validate:"required"` ProfileName string `json:"profileName" validate:"required"` Created int64 `json:"created"` Origin int64 `json:"origin" validate:"required"` Readings []BaseReading `json:"readings" validate:"gt=0,dive,required"` Tags map[string]string `json:"tags,omitempty" xml:"-"` // Have to ignore since map not supported for XML }
Event and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/Event
func FromEventModelToDTO ¶ added in v0.1.65
FromEventModelToDTO transforms the Event Model to the Event DTO
type ProfileResource ¶ added in v0.1.67
type ProfileResource struct { Name string `json:"name,omitempty" yaml:"name,omitempty" validate:"required,edgex-dto-none-empty-string"` 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 and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ProfileResource
func FromProfileResourceModelToDTO ¶ added in v0.1.86
func FromProfileResourceModelToDTO(p models.ProfileResource) ProfileResource
FromProfileResourceModelToDTO transforms the ProfileResource model to the ProfileResource DTO
func FromProfileResourceModelsToDTOs ¶ added in v0.1.86
func FromProfileResourceModelsToDTOs(profileResourceModels []models.ProfileResource) []ProfileResource
FromProfileResourceModelsToDTOs transforms the ProfileResource models to the ProfileResource DTOs
type PropertyValue ¶ added in v0.1.67
type PropertyValue struct { Type string `json:"type" yaml:"type" validate:"required,edgex-dto-none-empty-string"` 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"` MediaType string `json:"mediaType,omitempty" yaml:"mediaType,omitempty"` }
PropertyValue and its properties care defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/PropertyValue
func FromPropertyValueModelToDTO ¶ added in v0.1.86
func FromPropertyValueModelToDTO(p models.PropertyValue) PropertyValue
FromPropertyValueModelToDTO transforms the PropertyValue Model to the PropertyValue DTO
type ProtocolProperties ¶ added in v0.1.67
ProtocolProperties contains the device connection information in key/value pair
func FromProtocolPropertiesModelToDTO ¶ added in v0.1.89
func FromProtocolPropertiesModelToDTO(p models.ProtocolProperties) ProtocolProperties
FromProtocolPropertiesModelToDTO transforms the ProtocolProperties model to the ProtocolProperties DTO
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 and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ResourceOperation
func FromResourceOperationModelToDTO ¶ added in v0.1.86
func FromResourceOperationModelToDTO(ro models.ResourceOperation) ResourceOperation
FromResourceOperationModelToDTO transforms the ResourceOperation model to the ResourceOperation DTO
type SimpleReading ¶
type SimpleReading struct {
Value string `json:"value" validate:"required"`
}
SimpleReading and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/SimpleReading
type UpdateDevice ¶ added in v0.1.70
type UpdateDevice struct { Id *string `json:"id" validate:"required_without=Name,edgex-dto-uuid"` Name *string `json:"name" validate:"required_without=Id,edgex-dto-none-empty-string"` Description *string `json:"description" validate:"omitempty,edgex-dto-none-empty-string"` AdminState *string `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"` OperatingState *string `json:"operatingState" validate:"omitempty,oneof='UP' 'DOWN' 'UNKNOWN'"` LastConnected *int64 `json:"lastConnected"` LastReported *int64 `json:"lastReported"` ServiceName *string `json:"serviceName" validate:"omitempty,edgex-dto-none-empty-string"` ProfileName *string `json:"profileName" validate:"omitempty,edgex-dto-none-empty-string"` Labels []string `json:"labels"` Location interface{} `json:"location"` AutoEvents []AutoEvent `json:"autoEvents" validate:"dive"` Protocols map[string]ProtocolProperties `json:"protocols" validate:"omitempty,gt=0"` Notify *bool `json:"notify"` }
UpdateDevice and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateDevice
type UpdateDeviceService ¶ added in v0.1.70
type UpdateDeviceService struct { Id *string `json:"id" validate:"required_without=Name,edgex-dto-uuid"` Name *string `json:"name" validate:"required_without=Id,edgex-dto-none-empty-string"` BaseAddress *string `json:"baseAddress" validate:"omitempty,uri"` Labels []string `json:"labels"` AdminState *string `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"` }
UpdateDeviceService and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateDeviceService