dtos

package
v2.0.0-dev.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromProtocolModelsToDTOs

func FromProtocolModelsToDTOs(protocolModels map[string]models.ProtocolProperties) map[string]ProtocolProperties

FromProtocolModelsToDTOs transforms the Protocol model map to the Protocol DTO map

func ToAutoEventModel

func ToAutoEventModel(a AutoEvent) models.AutoEvent

ToAutoEventModel transforms the AutoEvent DTO to the AutoEvent model

func ToAutoEventModels

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

ToAutoEventModels transforms the AutoEvent DTO array to the AutoEvent model array

func ToCommandModel

func ToCommandModel(c Command) models.Command

ToCommandModel transforms the Command DTO to the Command model

func ToCommandModels

func ToCommandModels(commandDTOs []Command) []models.Command

ToCommandModels transforms the Command DTOs to the Command models

func ToDeviceModel

func ToDeviceModel(dto Device) models.Device

ToDeviceModel transforms the Device DTO to the Device Model

func ToDeviceProfileModel

func ToDeviceProfileModel(deviceProfileDTO DeviceProfile) models.DeviceProfile

ToDeviceProfileModel transforms the DeviceProfile DTO to the DeviceProfile model

func ToDeviceResourceModel

func ToDeviceResourceModel(d DeviceResource) models.DeviceResource

ToDeviceResourceModel transforms the DeviceResource DTO to the DeviceResource model

func ToDeviceResourceModels

func ToDeviceResourceModels(deviceResourceDTOs []DeviceResource) []models.DeviceResource

ToDeviceResourceModels transforms the DeviceResource DTOs to the DeviceResource models

func ToDeviceServiceModel

func ToDeviceServiceModel(dto DeviceService) models.DeviceService

ToDeviceServiceModel transforms the DeviceService DTO to the DeviceService Model

func ToProfileResourceModel

func ToProfileResourceModel(p ProfileResource) models.ProfileResource

ToProfileResourceModel transforms the ProfileResource DTO to the ProfileResource model

func ToProfileResourceModels

func ToProfileResourceModels(profileResourceDTOs []ProfileResource) []models.ProfileResource

ToProfileResourceModels transforms the ProfileResource DTOs to the ProfileResource models

func ToPropertyValueModel

func ToPropertyValueModel(p PropertyValue) models.PropertyValue

ToPropertyValueModel transforms the PropertyValue DTO to the PropertyValue model

func ToProtocolModels

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

ToProtocolModels transforms the Protocol DTO map to the Protocol model map

func ToProtocolPropertiesModel

func ToProtocolPropertiesModel(p ProtocolProperties) models.ProtocolProperties

ToPropertyValueModel transforms the ProtocolProperties DTO to the ProtocolProperties model

func ToProvisionWatcherModel

func ToProvisionWatcherModel(dto ProvisionWatcher) models.ProvisionWatcher

ToProvisionWatcherModel transforms the ProvisionWatcher DTO to the ProvisionWatcher model

func ToReadingModel

func ToReadingModel(r BaseReading) models.Reading

Convert Reading DTO to Reading model

func ToResourceOperationModel

func ToResourceOperationModel(ro ResourceOperation) models.ResourceOperation

ToResourceOperationModel transforms the ResourceOperation DTO to the ResourceOperation model

func ValidateDeviceProfileDTO

func ValidateDeviceProfileDTO(profile DeviceProfile) error

Types

type AutoEvent

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

func FromAutoEventModelToDTO(a models.AutoEvent) AutoEvent

FromAutoEventModelToDTO transforms the AutoEvent model to the AutoEvent DTO

func FromAutoEventModelsToDTOs

func FromAutoEventModelsToDTOs(autoEvents []models.AutoEvent) []AutoEvent

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,edgex-dto-rfc3986-unreserved-chars"`
	ResourceName       string `json:"resourceName" validate:"required,edgex-dto-rfc3986-unreserved-chars"`
	ProfileName        string `json:"profileName" validate:"required,edgex-dto-rfc3986-unreserved-chars"`
	ValueType          string `json:"valueType" validate:"required,edgex-dto-value-type"`
	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

func FromReadingModelToDTO(reading models.Reading) BaseReading

func (BaseReading) Validate

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

type Command struct {
	Name string `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	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

func FromCommandModelToDTO(c models.Command) Command

FromCommandModelToDTO transforms the Command model to the Command DTO

func FromCommandModelsToDTOs

func FromCommandModelsToDTOs(commandModels []models.Command) []Command

FromCommandModelsToDTOs transforms the Command models to the Command DTOs

type CoreCommand

type CoreCommand struct {
	Name       string `json:"name" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	DeviceName string `json:"deviceName" validate:"required,edgex-dto-rfc3986-unreserved-chars"`
	Get        bool   `json:"get" validate:"required_without=Put"`
	Put        bool   `json:"put" validate:"required_without=Get"`
	Path       string `json:"path,omitempty"`
	Url        string `json:"url,omitempty"`
}

CoreCommand and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.x#/CoreCommand

type Device

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,edgex-dto-rfc3986-unreserved-chars"`
	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,edgex-dto-rfc3986-unreserved-chars"`
	ProfileName        string                        `json:"profileName" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	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

func FromDeviceModelToDTO(d models.Device) Device

FromDeviceModelToDTO transforms the Device Model to the Device DTO

type DeviceProfile

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,edgex-dto-rfc3986-unreserved-chars"`
	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

func FromDeviceProfileModelToDTO(deviceProfile models.DeviceProfile) DeviceProfile

FromDeviceProfileModelToDTO transforms the DeviceProfile Model to the DeviceProfile DTO

type DeviceResource

type DeviceResource struct {
	Description string            `json:"description" yaml:"description,omitempty"`
	Name        string            `json:"name" yaml:"name,omitempty" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	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

func FromDeviceResourceModelToDTO(d models.DeviceResource) DeviceResource

FromDeviceResourceModelToDTO transforms the DeviceResource model to the DeviceResource DTO

func FromDeviceResourceModelsToDTOs

func FromDeviceResourceModelsToDTOs(deviceResourceModels []models.DeviceResource) []DeviceResource

FromDeviceResourceModelsToDTOs transforms the DeviceResource models to the DeviceResource DTOs

type DeviceService

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,edgex-dto-rfc3986-unreserved-chars"`
	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

func FromDeviceServiceModelToDTO(ds models.DeviceService) DeviceService

FromDeviceServiceModelToDTO transforms the DeviceService Model to the DeviceService DTO

type Event

type Event struct {
	common.Versionable `json:",inline"`
	Id                 string            `json:"id" validate:"required,uuid"`
	DeviceName         string            `json:"deviceName" validate:"required,edgex-dto-rfc3986-unreserved-chars"`
	ProfileName        string            `json:"profileName" validate:"required,edgex-dto-rfc3986-unreserved-chars"`
	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

func FromEventModelToDTO(event models.Event) Event

FromEventModelToDTO transforms the Event Model to the Event DTO

func (Event) ToXML

func (e Event) ToXML() (string, error)

ToXML provides a XML representation of the Event as a string

type ProfileResource

type ProfileResource struct {
	Name string              `` /* 126-byte string literal not displayed */
	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

func FromProfileResourceModelToDTO(p models.ProfileResource) ProfileResource

FromProfileResourceModelToDTO transforms the ProfileResource model to the ProfileResource DTO

func FromProfileResourceModelsToDTOs

func FromProfileResourceModelsToDTOs(profileResourceModels []models.ProfileResource) []ProfileResource

FromProfileResourceModelsToDTOs transforms the ProfileResource models to the ProfileResource DTOs

type PropertyValue

type PropertyValue struct {
	Type         string `json:"type" yaml:"type" validate:"required,edgex-dto-value-type"`
	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

func FromPropertyValueModelToDTO(p models.PropertyValue) PropertyValue

FromPropertyValueModelToDTO transforms the PropertyValue Model to the PropertyValue DTO

type ProtocolProperties

type ProtocolProperties map[string]string

ProtocolProperties contains the device connection information in key/value pair

func FromProtocolPropertiesModelToDTO

func FromProtocolPropertiesModelToDTO(p models.ProtocolProperties) ProtocolProperties

FromProtocolPropertiesModelToDTO transforms the ProtocolProperties model to the ProtocolProperties DTO

type ProvisionWatcher

type ProvisionWatcher struct {
	common.Versionable  `json:",inline"`
	Id                  string              `json:"id,omitempty" validate:"omitempty,uuid"`
	Name                string              `json:"name" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	Labels              []string            `json:"labels,omitempty"`
	Identifiers         map[string]string   `json:"identifiers" validate:"gt=0,dive,keys,required,endkeys,required"`
	BlockingIdentifiers map[string][]string `json:"blockingIdentifiers,omitempty"`
	ProfileName         string              `json:"profile" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	ServiceName         string              `json:"service" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	AdminState          string              `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"`
	AutoEvents          []AutoEvent         `json:"autoEvents,omitempty" validate:"dive"`
}

ProvisionWatcher and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ProvisionWatcher

func FromProvisionWatcherModelToDTO

func FromProvisionWatcherModelToDTO(pw models.ProvisionWatcher) ProvisionWatcher

FromProvisionWatcherModelToDTO transforms the ProvisionWatcher Model to the ProvisionWatcher DTO

type ResourceOperation

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

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

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,edgex-dto-rfc3986-unreserved-chars"`
	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,edgex-dto-rfc3986-unreserved-chars"`
	ProfileName    *string                       `json:"profileName" validate:"omitempty,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	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

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,edgex-dto-rfc3986-unreserved-chars"`
	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

type UpdateProvisionWatcher

type UpdateProvisionWatcher struct {
	common.Versionable  `json:",inline"`
	Id                  *string             `json:"id" validate:"required_without=Name,edgex-dto-uuid"`
	Name                *string             `json:"name" validate:"required_without=Id,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	Labels              []string            `json:"labels"`
	Identifiers         map[string]string   `json:"identifiers" validate:"omitempty,gt=0,dive,keys,required,endkeys,required"`
	BlockingIdentifiers map[string][]string `json:"blockingIdentifiers"`
	ProfileName         *string             `json:"profileName" validate:"omitempty,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	ServiceName         *string             `json:"serviceName" validate:"omitempty,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	AdminState          *string             `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"`
	AutoEvents          []AutoEvent         `json:"autoEvents" validate:"dive"`
}

UpdateProvisionWatcher and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateProvisionWatcher

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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