dtos

package
v4.0.0-dev.15 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: Apache-2.0 Imports: 15 Imported by: 15

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 ToAddressModel

func ToAddressModel(a Address) models.Address

func ToAddressModels

func ToAddressModels(dtos []Address) []models.Address

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 ToDeviceCommandModel

func ToDeviceCommandModel(dto DeviceCommand) models.DeviceCommand

ToDeviceCommandModel transforms the DeviceCommand DTO to the DeviceCommand model

func ToDeviceCommandModels

func ToDeviceCommandModels(deviceCommandDTOs []DeviceCommand) []models.DeviceCommand

ToDeviceCommandModels transforms the DeviceCommand DTOs to the DeviceCommand 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 ToDiscoveredDeviceModel

func ToDiscoveredDeviceModel(dto DiscoveredDevice) models.DiscoveredDevice

func ToNotificationModel

func ToNotificationModel(n Notification) models.Notification

ToNotificationModel transforms the Notification DTO to the Notification Model

func ToNotificationModels

func ToNotificationModels(notifications []Notification) []models.Notification

ToNotificationModels transforms the Notification DTO array to the Notification model array

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

ToProtocolPropertiesModel 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

ToReadingModel converts Reading DTO to Reading Model

func ToRegistrationModel

func ToRegistrationModel(dto Registration) models.Registration

func ToResourceOperationModel

func ToResourceOperationModel(ro ResourceOperation) models.ResourceOperation

ToResourceOperationModel transforms the ResourceOperation DTO to the ResourceOperation model

func ToResourceOperationModels

func ToResourceOperationModels(dtos []ResourceOperation) []models.ResourceOperation

func ToResourcePropertiesModel

func ToResourcePropertiesModel(p ResourceProperties) models.ResourceProperties

ToResourcePropertiesModel transforms the ResourceProperties DTO to the ResourceProperties model

func ToScheduleActionModel

func ToScheduleActionModel(dto ScheduleAction) models.ScheduleAction

func ToScheduleActionModels

func ToScheduleActionModels(dtos []ScheduleAction) []models.ScheduleAction

func ToScheduleActionRecordModels

func ToScheduleActionRecordModels(dtos []ScheduleActionRecord) []models.ScheduleActionRecord

func ToScheduleDefModel

func ToScheduleDefModel(dto ScheduleDef) models.ScheduleDef

func ToScheduleJobModel

func ToScheduleJobModel(dto ScheduleJob) models.ScheduleJob

func ToSubscriptionModel

func ToSubscriptionModel(s Subscription) models.Subscription

ToSubscriptionModel transforms the Subscription DTO to the Subscription Model

func ToSubscriptionModels

func ToSubscriptionModels(subs []Subscription) []models.Subscription

ToSubscriptionModels transforms the Subscription DTO array to the Subscription model array

func ToTransmissionModel

func ToTransmissionModel(trans Transmission) models.Transmission

ToTransmissionModel transforms a Transmission DTO to a Transmission Model

func ToTransmissionModels

func ToTransmissionModels(ts []Transmission) []models.Transmission

ToTransmissionModels transforms a Transmission DTO array to a Transmission model array

func ToTransmissionRecordModel

func ToTransmissionRecordModel(tr TransmissionRecord) models.TransmissionRecord

ToTransmissionRecordModel transforms a TransmissionRecord DTO to a TransmissionRecord Model

func ToTransmissionRecordModels

func ToTransmissionRecordModels(trs []TransmissionRecord) []models.TransmissionRecord

ToTransmissionRecordModels transforms a TransmissionRecord DTO array to a TransmissionRecord model array

func ValidateDeviceProfileDTO

func ValidateDeviceProfileDTO(profile DeviceProfile) error

func ValidateMetricName

func ValidateMetricName(name string, nameType string) error

func ValidateValue

func ValidateValue(valueType string, value string) error

ValidateValue used to check whether the value and valueType are matched

Types

type Address

type Address struct {
	Type string `json:"type" validate:"oneof='REST' 'MQTT' 'EMAIL' 'ZeroMQ'"`

	Scheme string `json:"scheme,omitempty"`
	Host   string `json:"host,omitempty" validate:"required_unless=Type EMAIL"`
	Port   int    `json:"port,omitempty" validate:"required_unless=Type EMAIL"`

	RESTAddress    `json:",inline" validate:"-"`
	MQTTPubAddress `json:",inline" validate:"-"`
	EmailAddress   `json:",inline" validate:"-"`
	ZeroMQAddress  `json:",inline" validate:"-"`
	MessageBus     `json:",inline" validate:"-"`
	Security       `json:",inline" validate:"-"`
}

func FromAddressModelToDTO

func FromAddressModelToDTO(address models.Address) Address

func FromAddressModelsToDTOs

func FromAddressModelsToDTOs(models []models.Address) []Address

func NewEmailAddress

func NewEmailAddress(recipients []string) Address

func NewMQTTAddress

func NewMQTTAddress(host string, port int, publisher string, topic string) Address

func NewMQTTAddressWithSecurity

func NewMQTTAddressWithSecurity(scheme string, host string, port int, publisher string, topic string, authMode string, secretPath string, skipCertVerify bool) Address

func NewRESTAddress

func NewRESTAddress(host string, port int, httpMethod string) Address

func NewZeroMQAddress

func NewZeroMQAddress(topic string) Address

func (*Address) Validate

func (a *Address) Validate() error

Validate satisfies the Validator interface

type AutoEvent

type AutoEvent struct {
	Interval          string  `json:"interval" yaml:"interval" validate:"required,edgex-dto-duration=1ms"` // min/max can be defined as params, ex. edgex-dto-duration=10ms0x2C24h
	OnChange          bool    `json:"onChange" yaml:"onChange"`
	OnChangeThreshold float64 `json:"onChangeThreshold" yaml:"onChangeThreshold" validate:"gte=0"`
	SourceName        string  `json:"sourceName" yaml:"sourceName" validate:"required"`
}

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

FromAutoEventModelsToDTOs transforms the AutoEvent model array to the AutoEvent DTO array

type BaseReading

type BaseReading struct {
	Id            string `json:"id,omitempty"`
	Origin        int64  `json:"origin" validate:"required"`
	DeviceName    string `json:"deviceName" validate:"required,edgex-dto-none-empty-string"`
	ResourceName  string `json:"resourceName" validate:"required,edgex-dto-none-empty-string"`
	ProfileName   string `json:"profileName" validate:"required,edgex-dto-none-empty-string"`
	ValueType     string `json:"valueType" validate:"required,edgex-dto-value-type"`
	Units         string `json:"units,omitempty"`
	Tags          Tags   `json:"tags,omitempty"`
	BinaryReading `json:",inline" validate:"-"`
	SimpleReading `json:",inline" validate:"-"`
	ObjectReading `json:",inline" validate:"-"`
	NullReading   `json:",inline" validate:"-"`
}

func FromReadingModelToDTO

func FromReadingModelToDTO(reading models.Reading) BaseReading

func NewBinaryReading

func NewBinaryReading(profileName string, deviceName string, resourceName string, binaryValue []byte, mediaType string) BaseReading

NewBinaryReading creates and returns a new initialized BaseReading with its BinaryReading initialized

func NewNullReading

func NewNullReading(profileName string, deviceName string, resourceName string, valueType string) BaseReading

NewNullReading creates and returns a new initialized BaseReading with null

func NewObjectReading

func NewObjectReading(profileName string, deviceName string, resourceName string, objectValue any) BaseReading

NewObjectReading creates and returns a new initialized BaseReading with its ObjectReading initialized

func NewObjectReadingWithArray

func NewObjectReadingWithArray(profileName string, deviceName string, resourceName string, objectValue any) BaseReading

NewObjectReadingWithArray creates and returns a new initialized BaseReading with its ObjectReading initialized with ObjectArray valueType

func NewSimpleReading

func NewSimpleReading(profileName string, deviceName string, resourceName string, valueType string, value any) (BaseReading, error)

NewSimpleReading creates and returns a new initialized BaseReading with its SimpleReading initialized

func (BaseReading) IsNull

func (b BaseReading) IsNull() bool

func (BaseReading) MarshalCBOR

func (b BaseReading) MarshalCBOR() ([]byte, error)

func (BaseReading) MarshalJSON

func (b BaseReading) MarshalJSON() ([]byte, error)

func (*BaseReading) Unmarshal

func (b *BaseReading) Unmarshal(data []byte, unmarshal func([]byte, any) error) error

func (*BaseReading) UnmarshalCBOR

func (b *BaseReading) UnmarshalCBOR(data []byte) error

func (*BaseReading) UnmarshalJSON

func (b *BaseReading) UnmarshalJSON(data []byte) error

func (BaseReading) UnmarshalObjectValue

func (b BaseReading) UnmarshalObjectValue(target any) error

UnmarshalObjectValue is a helper function used to unmarshal the ObjectValue of a reading to the passed in target type. Note that this function will only work on readings with 'Object' or 'ObjectArray' valueType. An error will be returned when invoking this function on a reading with valueType other than 'Object' or 'ObjectArray'.

func (BaseReading) Validate

func (b BaseReading) Validate() error

Validate satisfies the Validator interface

type BinaryReading

type BinaryReading struct {
	BinaryValue []byte `json:"binaryValue,omitempty" validate:"omitempty"`
	MediaType   string `json:"mediaType,omitempty" validate:"required_with=BinaryValue"`
}

type CoreCommand

type CoreCommand struct {
	Name       string                 `json:"name" validate:"required,edgex-dto-none-empty-string"`
	Get        bool                   `json:"get,omitempty" validate:"required_without=Set"`
	Set        bool                   `json:"set,omitempty" validate:"required_without=Get"`
	Path       string                 `json:"path,omitempty"`
	Url        string                 `json:"url,omitempty"`
	Parameters []CoreCommandParameter `json:"parameters,omitempty"`
}

type CoreCommandParameter

type CoreCommandParameter struct {
	ResourceName string `json:"resourceName"`
	ValueType    string `json:"valueType"`
}

type CronScheduleDef

type CronScheduleDef struct {
	Crontab string `json:"crontab,omitempty" validate:"required"`
}

type DBTimestamp

type DBTimestamp struct {
	Created  int64 `json:"created,omitempty"`
	Modified int64 `json:"modified,omitempty"`
}

type Device

type Device struct {
	DBTimestamp    `json:",inline"`
	Id             string                        `json:"id,omitempty" yaml:"id,omitempty" validate:"omitempty,uuid"`
	Name           string                        `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string"`
	Parent         string                        `json:"parent,omitempty" yaml:"parent,omitempty"`
	Description    string                        `json:"description,omitempty" yaml:"description,omitempty"`
	AdminState     string                        `json:"adminState" yaml:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"`
	OperatingState string                        `json:"operatingState" yaml:"operatingState" validate:"oneof='UP' 'DOWN' 'UNKNOWN'"`
	Labels         []string                      `json:"labels,omitempty" yaml:"labels,omitempty"`
	Location       interface{}                   `json:"location,omitempty" yaml:"location,omitempty"`
	ServiceName    string                        `json:"serviceName" yaml:"serviceName" validate:"required,edgex-dto-none-empty-string"`
	ProfileName    string                        `json:"profileName,omitempty" yaml:"profileName,omitempty"`
	AutoEvents     []AutoEvent                   `json:"autoEvents,omitempty" yaml:"autoEvents,omitempty" validate:"dive"`
	Protocols      map[string]ProtocolProperties `json:"protocols" yaml:"protocols" validate:"required"`
	Tags           map[string]any                `json:"tags,omitempty" yaml:"tags,omitempty"`
	Properties     map[string]any                `json:"properties" yaml:"properties"`
}

func FromDeviceModelToDTO

func FromDeviceModelToDTO(d models.Device) Device

FromDeviceModelToDTO transforms the Device Model to the Device DTO

type DeviceCommand

type DeviceCommand struct {
	Name               string              `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string"`
	IsHidden           bool                `json:"isHidden" yaml:"isHidden"`
	ReadWrite          string              `json:"readWrite" yaml:"readWrite" validate:"required,oneof='R' 'W' 'RW' 'WR'"`
	ResourceOperations []ResourceOperation `json:"resourceOperations" yaml:"resourceOperations" validate:"gt=0,dive"`
	Tags               map[string]any      `json:"tags,omitempty" yaml:"tags,omitempty"`
}

func FromDeviceCommandModelToDTO

func FromDeviceCommandModelToDTO(d models.DeviceCommand) DeviceCommand

FromDeviceCommandModelToDTO transforms the DeviceCommand model to the DeviceCommand DTO

func FromDeviceCommandModelsToDTOs

func FromDeviceCommandModelsToDTOs(deviceCommandModels []models.DeviceCommand) []DeviceCommand

FromDeviceCommandModelsToDTOs transforms the DeviceCommand models to the DeviceCommand DTOs

type DeviceControlAction

type DeviceControlAction struct {
	DeviceName string `json:"deviceName,omitempty" validate:"required"`
	SourceName string `json:"sourceName,omitempty" validate:"required"`
}

type DeviceCoreCommand

type DeviceCoreCommand struct {
	DeviceName   string        `json:"deviceName" validate:"required,edgex-dto-none-empty-string"`
	ProfileName  string        `json:"profileName" validate:"required,edgex-dto-none-empty-string"`
	CoreCommands []CoreCommand `json:"coreCommands,omitempty" validate:"dive"`
}

type DeviceProfile

type DeviceProfile struct {
	DeviceProfileBasicInfo `json:",inline" yaml:",inline"`
	DeviceResources        []DeviceResource `json:"deviceResources" yaml:"deviceResources" validate:"dive"`
	DeviceCommands         []DeviceCommand  `json:"deviceCommands" yaml:"deviceCommands" validate:"dive"`
	ApiVersion             string           `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
}

func FromDeviceProfileModelToDTO

func FromDeviceProfileModelToDTO(deviceProfile models.DeviceProfile) DeviceProfile

FromDeviceProfileModelToDTO transforms the DeviceProfile Model to the DeviceProfile DTO

func (*DeviceProfile) UnmarshalYAML

func (dp *DeviceProfile) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the Unmarshaler interface for the DeviceProfile type

func (*DeviceProfile) Validate

func (dp *DeviceProfile) Validate() error

Validate satisfies the Validator interface

type DeviceProfileBasicInfo

type DeviceProfileBasicInfo struct {
	DBTimestamp  `json:",inline" yaml:"dbTimestamp,omitempty"`
	Id           string   `json:"id,omitempty" validate:"omitempty,uuid" yaml:"id,omitempty"`
	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"`
}

func FromDeviceProfileModelToBasicInfoDTO

func FromDeviceProfileModelToBasicInfoDTO(deviceProfile models.DeviceProfile) DeviceProfileBasicInfo

FromDeviceProfileModelToBasicInfoDTO transforms the DeviceProfile Model to the DeviceProfileBasicInfo DTO

type DeviceResource

type DeviceResource struct {
	Description string                 `json:"description,omitempty" yaml:"description,omitempty"`
	Name        string                 `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string"`
	IsHidden    bool                   `json:"isHidden" yaml:"isHidden"`
	Properties  ResourceProperties     `json:"properties" yaml:"properties"`
	Attributes  map[string]interface{} `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	Tags        map[string]any         `json:"tags,omitempty" yaml:"tags,omitempty"`
}

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

func (*DeviceResource) Validate

func (dr *DeviceResource) Validate() error

Validate satisfies the Validator interface

type DeviceService

type DeviceService struct {
	DBTimestamp `json:",inline"`
	Id          string         `json:"id,omitempty" validate:"omitempty,uuid"`
	Name        string         `json:"name" validate:"required,edgex-dto-none-empty-string"`
	Description string         `json:"description,omitempty"`
	Labels      []string       `json:"labels,omitempty"`
	BaseAddress string         `json:"baseAddress" validate:"required,uri"`
	AdminState  string         `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"`
	Properties  map[string]any `json:"properties" yaml:"properties"`
}

func FromDeviceServiceModelToDTO

func FromDeviceServiceModelToDTO(ds models.DeviceService) DeviceService

FromDeviceServiceModelToDTO transforms the DeviceService Model to the DeviceService DTO

type DiscoveredDevice

type DiscoveredDevice struct {
	ProfileName string         `json:"profileName" yaml:"profileName" validate:"len=0|edgex-dto-none-empty-string"`
	AdminState  string         `json:"adminState" yaml:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"`
	AutoEvents  []AutoEvent    `json:"autoEvents,omitempty" yaml:"autoEvents,omitempty" validate:"dive"`
	Properties  map[string]any `json:"properties" yaml:"properties"`
}

func FromDiscoveredDeviceModelToDTO

func FromDiscoveredDeviceModelToDTO(d models.DiscoveredDevice) DiscoveredDevice

type EdgeXMessageBusAction

type EdgeXMessageBusAction struct {
	Topic string `json:"topic,omitempty" validate:"required"`
}

type EmailAddress

type EmailAddress struct {
	Recipients []string `json:"recipients,omitempty" validate:"gt=0,dive,email"`
}

type Event

type Event struct {
	common.Versionable `json:",inline"`
	Id                 string        `json:"id" validate:"required,uuid"`
	DeviceName         string        `json:"deviceName" validate:"required,edgex-dto-none-empty-string"`
	ProfileName        string        `json:"profileName" validate:"required,edgex-dto-none-empty-string"`
	SourceName         string        `json:"sourceName" validate:"required,edgex-dto-none-empty-string"`
	Origin             int64         `json:"origin" validate:"required"`
	Readings           []BaseReading `json:"readings" validate:"gt=0,dive,required"`
	Tags               Tags          `json:"tags,omitempty"`
}

func FromEventModelToDTO

func FromEventModelToDTO(event models.Event) Event

FromEventModelToDTO transforms the Event Model to the Event DTO

func NewEvent

func NewEvent(profileName, deviceName, sourceName string) Event

NewEvent creates and returns an initialized Event with no Readings

func (*Event) AddBinaryReading

func (e *Event) AddBinaryReading(resourceName string, binaryValue []byte, mediaType string)

AddBinaryReading adds a binary reading to the Event

func (*Event) AddNullReading

func (e *Event) AddNullReading(resourceName string, valueType string)

AddNullReading adds a simple reading with null value to the Event

func (*Event) AddObjectReading

func (e *Event) AddObjectReading(resourceName string, objectValue interface{})

AddObjectReading adds a object reading to the Event

func (*Event) AddSimpleReading

func (e *Event) AddSimpleReading(resourceName string, valueType string, value interface{}) error

AddSimpleReading adds a simple reading to the Event

func (*Event) ToXML

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

ToXML provides a XML representation of the Event as a string

type HealthCheck

type HealthCheck struct {
	Interval string `json:"interval" validate:"required,edgex-dto-duration"`
	Path     string `json:"path" validate:"required"`
	Type     string `json:"type" validate:"required"`
}

type IntervalScheduleDef

type IntervalScheduleDef struct {
	Interval string `json:"interval,omitempty" validate:"required,edgex-dto-duration"`
}

type MQTTPubAddress

type MQTTPubAddress struct {
	Publisher      string `json:"publisher,omitempty" validate:"required"`
	QoS            int    `json:"qos,omitempty"`
	KeepAlive      int    `json:"keepAlive,omitempty"`
	Retained       bool   `json:"retained,omitempty"`
	AutoReconnect  bool   `json:"autoReconnect,omitempty"`
	ConnectTimeout int    `json:"connectTimeout,omitempty"`
}

type MessageBus

type MessageBus struct {
	Topic string `json:"topic,omitempty" validate:"required"`
}

type Metric

type Metric struct {
	common.Versionable `json:",inline"`
	// Name is the identifier of the collected Metric
	Name string `json:"name" validate:"edgex-dto-none-empty-string"`
	// Fields are the Key/Value measurements associated with the metric
	Fields []MetricField `json:"fields,omitempty" validate:"required"`
	// Tags and the Key/Value tags associated with the metric
	Tags []MetricTag `json:"tags,omitempty"`
	// Timestamp is the time and date the metric was collected.
	Timestamp int64 `json:"timestamp" validate:"required"`
}

Metric defines the metric data for a specific named metric

func NewMetric

func NewMetric(name string, fields []MetricField, tags []MetricTag) (Metric, error)

NewMetric creates a new metric for the specified data

func (*Metric) ToLineProtocol

func (m *Metric) ToLineProtocol() string

ToLineProtocol transforms the Metric to Line Protocol syntax which is most commonly used with InfluxDB For more information on Line Protocol see: https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/ Line Protocol Syntax:

<measurement>[,<tag_key>=<tag_value>[,<tag_key>=<tag_value>]] <field_key>=<field_value>[,<field_key>=<field_value>] [<timestamp>]

Examples:

measurementName fieldKey="field string value" 1556813561098000000
myMeasurement,tag1=value1,tag2=value2 fieldKey="fieldValue" 1556813561098000000

Note that this is a simple helper function for those receiving this DTO that are pushing metrics to an endpoint that receives LineProtocol such as InfluxDb or Telegraf

type MetricField

type MetricField struct {
	// Name is the identifier of the metric field
	Name string `json:"name" validate:"edgex-dto-none-empty-string"`
	// Value is measurement for the metric field
	Value interface{} `json:"value" validate:"required"`
}

MetricField defines a metric field associated with a metric

type MetricTag

type MetricTag struct {
	// Name is the identifier of the metric tag
	Name string `json:"name" validate:"edgex-dto-none-empty-string"`
	// Value is tag vale for the metric tag
	Value string `json:"value" validate:"required"`
}

MetricTag defines a metric tag associated with a metric

type Notification

type Notification struct {
	DBTimestamp  `json:",inline"`
	Id           string   `json:"id,omitempty" validate:"omitempty,uuid"`
	Category     string   `` /* 133-byte string literal not displayed */
	Labels       []string `` /* 143-byte string literal not displayed */
	Content      string   `json:"content" validate:"required,edgex-dto-none-empty-string"`
	ContentType  string   `json:"contentType,omitempty"`
	Description  string   `json:"description,omitempty"`
	Sender       string   `json:"sender" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	Severity     string   `json:"severity" validate:"required,oneof='MINOR' 'NORMAL' 'CRITICAL'"`
	Status       string   `json:"status,omitempty" validate:"omitempty,oneof='NEW' 'PROCESSED' 'ESCALATED'"`
	Acknowledged bool     `json:"acknowledged"`
}

func FromNotificationModelToDTO

func FromNotificationModelToDTO(n models.Notification) Notification

FromNotificationModelToDTO transforms the Notification Model to the Notification DTO

func FromNotificationModelsToDTOs

func FromNotificationModelsToDTOs(notifications []models.Notification) []Notification

FromNotificationModelsToDTOs transforms the Notification model array to the Notification DTO array

func NewNotification

func NewNotification(labels []string, category, content, sender, severity string) Notification

NewNotification creates and returns a Notification DTO

type NullReading

type NullReading struct {
	// contains filtered or unexported fields
}

type ObjectReading

type ObjectReading struct {
	ObjectValue any `json:"objectValue,omitempty"`
}

type ProtocolProperties

type ProtocolProperties map[string]any

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 {
	DBTimestamp         `json:",inline"`
	Id                  string              `json:"id,omitempty" yaml:"id,omitempty" validate:"omitempty,uuid"`
	Name                string              `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string"`
	ServiceName         string              `json:"serviceName" yaml:"serviceName" validate:"required,edgex-dto-none-empty-string"`
	Labels              []string            `json:"labels,omitempty" yaml:"labels,omitempty"`
	Identifiers         map[string]string   `json:"identifiers" yaml:"identifiers" validate:"gt=0,dive,keys,required,endkeys,required"`
	BlockingIdentifiers map[string][]string `json:"blockingIdentifiers,omitempty" yaml:"blockingIdentifiers,omitempty"`
	AdminState          string              `json:"adminState" yaml:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"`
	DiscoveredDevice    DiscoveredDevice    `json:"discoveredDevice" yaml:"discoveredDevice"`
}

func FromProvisionWatcherModelToDTO

func FromProvisionWatcherModelToDTO(pw models.ProvisionWatcher) ProvisionWatcher

FromProvisionWatcherModelToDTO transforms the ProvisionWatcher Model to the ProvisionWatcher DTO

type RESTAction

type RESTAction struct {
	Address         string `json:"address,omitempty" validate:"required"`
	Method          string `json:"method,omitempty" validate:"required"`
	InjectEdgeXAuth bool   `json:"injectEdgeXAuth,omitempty"`
}

type RESTAddress

type RESTAddress struct {
	Path            string `json:"path,omitempty"`
	HTTPMethod      string `json:"httpMethod,omitempty" validate:"required,oneof='GET' 'HEAD' 'POST' 'PUT' 'PATCH' 'DELETE' 'TRACE' 'CONNECT'"`
	InjectEdgeXAuth bool   `json:"injectEdgeXAuth,omitempty"`
}

type Registration

type Registration struct {
	DBTimestamp `json:",inline"`
	ServiceId   string      `json:"serviceId" validate:"required"`
	Status      string      `json:"status"`
	Host        string      `json:"host" validate:"required"`
	Port        int         `json:"port" validate:"required"`
	HealthCheck HealthCheck `json:",inline"`
}

func FromRegistrationModelToDTO

func FromRegistrationModelToDTO(r models.Registration) Registration

func (*Registration) Validate

func (r *Registration) Validate() error

type ResourceOperation

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

func FromResourceOperationModelToDTO

func FromResourceOperationModelToDTO(ro models.ResourceOperation) ResourceOperation

FromResourceOperationModelToDTO transforms the ResourceOperation model to the ResourceOperation DTO

type ResourceProperties

type ResourceProperties struct {
	ValueType    string         `json:"valueType" yaml:"valueType" validate:"required,edgex-dto-value-type"`
	ReadWrite    string         `json:"readWrite" yaml:"readWrite" validate:"required,oneof='R' 'W' 'RW' 'WR'"`
	Units        string         `json:"units,omitempty" yaml:"units,omitempty"`
	Minimum      *float64       `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	Maximum      *float64       `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	DefaultValue string         `json:"defaultValue,omitempty" yaml:"defaultValue,omitempty"`
	Mask         *uint64        `json:"mask,omitempty" yaml:"mask,omitempty"`
	Shift        *int64         `json:"shift,omitempty" yaml:"shift,omitempty"`
	Scale        *float64       `json:"scale,omitempty" yaml:"scale,omitempty"`
	Offset       *float64       `json:"offset,omitempty" yaml:"offset,omitempty"`
	Base         *float64       `json:"base,omitempty" yaml:"base,omitempty"`
	Assertion    string         `json:"assertion,omitempty" yaml:"assertion,omitempty"`
	MediaType    string         `json:"mediaType,omitempty" yaml:"mediaType,omitempty"`
	Optional     map[string]any `json:"optional,omitempty" yaml:"optional"`
}

func FromResourcePropertiesModelToDTO

func FromResourcePropertiesModelToDTO(p models.ResourceProperties) ResourceProperties

FromResourcePropertiesModelToDTO transforms the ResourceProperties Model to the ResourceProperties DTO

type ScheduleAction

type ScheduleAction struct {
	Type        string `json:"type" validate:"oneof='EDGEXMESSAGEBUS' 'REST' 'DEVICECONTROL'"`
	ContentType string `json:"contentType,omitempty"`
	Payload     []byte `json:"payload,omitempty"`

	EdgeXMessageBusAction `json:",inline" validate:"-"`
	RESTAction            `json:",inline" validate:"-"`
	DeviceControlAction   `json:",inline" validate:"-"`
}

func FromScheduleActionModelToDTO

func FromScheduleActionModelToDTO(model models.ScheduleAction) ScheduleAction

func FromScheduleActionModelsToDTOs

func FromScheduleActionModelsToDTOs(models []models.ScheduleAction) []ScheduleAction

func (*ScheduleAction) UnmarshalJSON

func (s *ScheduleAction) UnmarshalJSON(b []byte) error

func (*ScheduleAction) Validate

func (s *ScheduleAction) Validate() error

type ScheduleActionRecord

type ScheduleActionRecord struct {
	Id          string         `json:"id,omitempty" validate:"omitempty,uuid"`
	JobName     string         `json:"jobName" validate:"edgex-dto-none-empty-string"`
	Action      ScheduleAction `json:"action" validate:"required"`
	Status      string         `json:"status" validate:"required,oneof='SUCCEEDED' 'FAILED' 'MISSED'"`
	ScheduledAt int64          `json:"scheduledAt,omitempty"`
	Created     int64          `json:"created,omitempty"`
}

func FromScheduleActionRecordModelToDTO

func FromScheduleActionRecordModelToDTO(model models.ScheduleActionRecord) ScheduleActionRecord

func FromScheduleActionRecordModelsToDTOs

func FromScheduleActionRecordModelsToDTOs(records []models.ScheduleActionRecord) []ScheduleActionRecord

func (*ScheduleActionRecord) Validate

func (c *ScheduleActionRecord) Validate() error

Validate satisfies the Validator interface

type ScheduleDef

type ScheduleDef struct {
	Type           string `json:"type" validate:"oneof='INTERVAL' 'CRON'"`
	StartTimestamp int64  `json:"startTimestamp,omitempty"`
	EndTimestamp   int64  `json:"endTimestamp,omitempty"`

	IntervalScheduleDef `json:",inline" validate:"-"`
	CronScheduleDef     `json:",inline" validate:"-"`
}

func FromScheduleDefModelToDTO

func FromScheduleDefModelToDTO(model models.ScheduleDef) ScheduleDef

func (*ScheduleDef) Validate

func (s *ScheduleDef) Validate() error

Validate satisfies the Validator interface

type ScheduleJob

type ScheduleJob struct {
	DBTimestamp              `json:",inline"`
	Id                       string           `json:"id,omitempty" validate:"omitempty,uuid"`
	Name                     string           `json:"name" validate:"edgex-dto-none-empty-string"`
	Definition               ScheduleDef      `json:"definition" validate:"required"`
	AutoTriggerMissedRecords bool             `json:"autoTriggerMissedRecords,omitempty"`
	Actions                  []ScheduleAction `json:"actions" validate:"required,gt=0,dive"`
	AdminState               string           `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"`
	Labels                   []string         `json:"labels,omitempty"`
	Properties               map[string]any   `json:"properties"`
}

func FromScheduleJobModelToDTO

func FromScheduleJobModelToDTO(model models.ScheduleJob) ScheduleJob

func (*ScheduleJob) Validate

func (s *ScheduleJob) Validate() error

Validate satisfies the Validator interface

type Security

type Security struct {
	SecretPath     string `json:"secretPath,omitempty" validate:"required"`
	AuthMode       string `json:"authMode,omitempty" validate:"required,oneof='none' 'usernamepassword' 'cacert' 'clientcert'"`
	SkipCertVerify bool   `json:"skipCertVerify,omitempty"`
}

type SimpleReading

type SimpleReading struct {
	Value string `json:"value"`
}

type Subscription

type Subscription struct {
	DBTimestamp    `json:",inline"`
	Id             string    `json:"id,omitempty" validate:"omitempty,uuid"`
	Name           string    `json:"name" validate:"required,edgex-dto-none-empty-string"`
	Channels       []Address `json:"channels" validate:"required,gt=0,dive"`
	Receiver       string    `json:"receiver" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	Categories     []string  `` /* 145-byte string literal not displayed */
	Labels         []string  `` /* 145-byte string literal not displayed */
	Description    string    `json:"description,omitempty"`
	ResendLimit    int       `json:"resendLimit,omitempty"`
	ResendInterval string    `json:"resendInterval,omitempty" validate:"omitempty,edgex-dto-duration"`
	AdminState     string    `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"`
}

func FromSubscriptionModelToDTO

func FromSubscriptionModelToDTO(s models.Subscription) Subscription

FromSubscriptionModelToDTO transforms the Subscription Model to the Subscription DTO

func FromSubscriptionModelsToDTOs

func FromSubscriptionModelsToDTOs(subscruptions []models.Subscription) []Subscription

FromSubscriptionModelsToDTOs transforms the Subscription model array to the Subscription DTO array

type SystemEvent

type SystemEvent struct {
	common.Versionable `json:",inline"`
	Type               string            `json:"type"`
	Action             string            `json:"action"`
	Source             string            `json:"source"`
	Owner              string            `json:"owner"`
	Tags               map[string]string `json:"tags"`
	Details            any               `json:"details"`
	Timestamp          int64             `json:"timestamp"`
}

SystemEvent defines the data for a system event

func NewSystemEvent

func NewSystemEvent(eventType, action, source, owner string, tags map[string]string, details any) SystemEvent

NewSystemEvent creates a new SystemEvent for the specified data

func (*SystemEvent) DecodeDetails

func (s *SystemEvent) DecodeDetails(details any) error

DecodeDetails decodes the details (any type) into the passed in object

type Tags

type Tags map[string]any

func (Tags) MarshalXML

func (t Tags) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML fulfills the Marshaler interface for Tags field, which is being ignored from XML Marshaling since maps are not supported. We have to provide our own marshaling of the Tags field if it is non-empty.

type Transmission

type Transmission struct {
	Created          int64                `json:"created,omitempty"`
	Id               string               `json:"id,omitempty" validate:"omitempty,uuid"`
	Channel          Address              `json:"channel" validate:"required"`
	NotificationId   string               `json:"notificationId" validate:"required"`
	SubscriptionName string               `json:"subscriptionName" validate:"required,edgex-dto-none-empty-string"`
	Records          []TransmissionRecord `json:"records,omitempty"`
	ResendCount      int                  `json:"resendCount,omitempty"`
	Status           string               `json:"status" validate:"required,oneof='ACKNOWLEDGED' 'FAILED' 'SENT' 'ESCALATED' 'RESENDING'"`
}

func FromTransmissionModelToDTO

func FromTransmissionModelToDTO(trans models.Transmission) Transmission

FromTransmissionModelToDTO transforms a Transmission Model to a Transmission DTO

func FromTransmissionModelsToDTOs

func FromTransmissionModelsToDTOs(ts []models.Transmission) []Transmission

FromTransmissionModelsToDTOs transforms a Transmission model array to a Transmission DTO array

type TransmissionRecord

type TransmissionRecord struct {
	Status   string `json:"status,omitempty" validate:"omitempty,oneof='ACKNOWLEDGED' 'FAILED' 'SENT' 'ESCALATED'"`
	Response string `json:"response,omitempty"`
	Sent     int64  `json:"sent,omitempty"`
}

func FromTransmissionRecordModelToDTO

func FromTransmissionRecordModelToDTO(tr models.TransmissionRecord) TransmissionRecord

FromTransmissionRecordModelToDTO transforms a TransmissionRecord Model to a TransmissionRecord DTO

func FromTransmissionRecordModelsToDTOs

func FromTransmissionRecordModelsToDTOs(trs []models.TransmissionRecord) []TransmissionRecord

FromTransmissionRecordModelsToDTOs transforms a TransmissionRecord model array to a TransmissionRecord DTO array

func (TransmissionRecord) String

func (tr TransmissionRecord) String() string

String returns a JSON encoded string representation of the object

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"`
	Parent         *string                       `json:"parent,omitempty" yaml:"parent,omitempty"`
	Description    *string                       `json:"description" validate:"omitempty"`
	AdminState     *string                       `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"`
	OperatingState *string                       `json:"operatingState" validate:"omitempty,oneof='UP' 'DOWN' 'UNKNOWN'"`
	ServiceName    *string                       `json:"serviceName" validate:"omitempty,edgex-dto-none-empty-string"`
	ProfileName    *string                       `json:"profileName" validate:"omitempty"`
	Labels         []string                      `json:"labels"`
	Location       interface{}                   `json:"location"`
	AutoEvents     []AutoEvent                   `json:"autoEvents" validate:"dive"`
	Protocols      map[string]ProtocolProperties `json:"protocols" validate:"omitempty"`
	Tags           map[string]any                `json:"tags"`
	Properties     map[string]any                `json:"properties"`
}

func FromDeviceModelToUpdateDTO

func FromDeviceModelToUpdateDTO(d models.Device) UpdateDevice

FromDeviceModelToUpdateDTO transforms the Device Model to the UpdateDevice DTO

type UpdateDeviceCommand

type UpdateDeviceCommand struct {
	Name     *string `json:"name" validate:"required,edgex-dto-none-empty-string"`
	IsHidden *bool   `json:"isHidden"`
}

type UpdateDeviceProfileBasicInfo

type UpdateDeviceProfileBasicInfo 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"`
	Manufacturer *string  `json:"manufacturer"`
	Description  *string  `json:"description"`
	Model        *string  `json:"model"`
	Labels       []string `json:"labels"`
}

type UpdateDeviceResource

type UpdateDeviceResource struct {
	Description *string `json:"description"`
	Name        *string `json:"name" validate:"required,edgex-dto-none-empty-string"`
	IsHidden    *bool   `json:"isHidden"`
}

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"`
	Description *string        `json:"description"`
	BaseAddress *string        `json:"baseAddress" validate:"omitempty,uri"`
	Labels      []string       `json:"labels"`
	AdminState  *string        `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"`
	Properties  map[string]any `json:"properties"`
}

func FromDeviceServiceModelToUpdateDTO

func FromDeviceServiceModelToUpdateDTO(ds models.DeviceService) UpdateDeviceService

FromDeviceServiceModelToUpdateDTO transforms the DeviceService Model to the UpdateDeviceService DTO

type UpdateDiscoveredDevice

type UpdateDiscoveredDevice struct {
	ProfileName *string        `json:"profileName" validate:"omitempty,len=0|edgex-dto-none-empty-string"`
	AdminState  *string        `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"`
	AutoEvents  []AutoEvent    `json:"autoEvents" validate:"dive"`
	Properties  map[string]any `json:"properties"`
}

func FromDiscoveredDeviceModelToUpdateDTO

func FromDiscoveredDeviceModelToUpdateDTO(d models.DiscoveredDevice) UpdateDiscoveredDevice

type UpdateProvisionWatcher

type UpdateProvisionWatcher 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"`
	ServiceName         *string                `json:"serviceName" validate:"omitempty,edgex-dto-none-empty-string"`
	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"`
	AdminState          *string                `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"`
	DiscoveredDevice    UpdateDiscoveredDevice `json:"discoveredDevice"`
}

func FromProvisionWatcherModelToUpdateDTO

func FromProvisionWatcherModelToUpdateDTO(pw models.ProvisionWatcher) UpdateProvisionWatcher

FromProvisionWatcherModelToUpdateDTO transforms the ProvisionWatcher Model to the UpdateProvisionWatcher DTO

type UpdateScheduleJob

type UpdateScheduleJob 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"`
	Definition               *ScheduleDef     `json:"definition" validate:"omitempty"`
	AutoTriggerMissedRecords *bool            `json:"autoTriggerMissedRecords,omitempty"`
	Actions                  []ScheduleAction `json:"actions,omitempty"`
	AdminState               *string          `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"`
	Labels                   []string         `json:"labels,omitempty"`
	Properties               map[string]any   `json:"properties,omitempty"`
}

type UpdateSubscription

type UpdateSubscription 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"`
	Channels       []Address `json:"channels" validate:"omitempty,gt=0,dive"`
	Receiver       *string   `json:"receiver" validate:"omitempty,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	Categories     []string  `json:"categories" validate:"omitempty,dive,gt=0,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	Labels         []string  `json:"labels" validate:"omitempty,dive,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	Description    *string   `json:"description"`
	ResendLimit    *int      `json:"resendLimit"`
	ResendInterval *string   `json:"resendInterval" validate:"omitempty,edgex-dto-duration"`
	AdminState     *string   `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"`
}

type ZeroMQAddress

type ZeroMQAddress struct {
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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