Documentation
¶
Index ¶
- Constants
- Variables
- type Address
- type AdminState
- type Alarm
- type AlarmSeverity
- type Application
- type ApplicationDevice
- type AuthMethod
- type AutoEvent
- type BaseAddress
- type BaseReading
- type BinaryReading
- type BulkOperation
- type BulkOperationEvent
- type BulkOperationEventActionKind
- type BulkOperationStatus
- type BulkOperationStatusKind
- type ChannelType
- type DBTimestamp
- type Device
- type DeviceAlarm
- type DeviceAlarmHistory
- type DeviceCommand
- type DeviceHistory
- type DeviceModel
- type DeviceProfile
- type DeviceResource
- type DeviceService
- type DeviceStatus
- type DiscoveredDevice
- type EmailAddress
- type Event
- type GenericBulkOperationStatusUpdateEvent
- type Interval
- type IntervalAction
- type LabelsWithDeviceCount
- type Layer
- type Link
- type LogEntry
- type MQTTPubAddress
- type Manufacturer
- type Notification
- type NotificationSeverity
- type NotificationStatus
- type ObjectReading
- type OperatingState
- type Organization
- type ProtocolProperties
- type ProvisionWatcher
- type RESTAddress
- type Reading
- type ResourceOperation
- type ResourceProperties
- type SilenceKind
- type SimpleReading
- type StatusKind
- type Subscription
- type Transmission
- type TransmissionRecord
- type TransmissionStatus
Constants ¶
const ( // Locked : device is locked // Unlocked : device is unlocked Locked = "LOCKED" Unlocked = "UNLOCKED" )
Constants for AdminState
const ( Rest = "REST" Email = "EMAIL" )
Constants for ChannelType
const ( Minor = "MINOR" Critical = "CRITICAL" Normal = "NORMAL" )
Constants for NotificationSeverity
const ( New = "NEW" Processed = "PROCESSED" EscalationSubscriptionName = "ESCALATION" EscalationPrefix = "escalated-" EscalatedContentNotice = "This notification is escalated by the transmission" )
Constants for NotificationStatus
const ( Failed = "FAILED" Sent = "SENT" Acknowledged = "ACKNOWLEDGED" RESENDING = "RESENDING" )
Constants for TransmissionStatus
const ( Up = "UP" Down = "DOWN" Unknown = "UNKNOWN" )
Constants for OperatingState
const ( TraceLog = "TRACE" DebugLog = "DEBUG" InfoLog = "INFO" WarnLog = "WARN" ErrorLog = "ERROR" )
These constants identify the log levels in order of increasing severity.
const (
Escalated = "ESCALATED"
)
Constants for both NotificationStatus and TransmissionStatus
Variables ¶
var SeverityOrder = map[AlarmSeverity]int{ AlarmOffline: 5, AlarmCritical: 4, AlarmMajor: 3, AlarmMinor: 2, AlarmWarning: 1, AlarmNone: 0, }
SeverityOrder defines the order of severity levels.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address interface {
GetBaseAddress() BaseAddress
}
type AdminState ¶
type AdminState string
AdminState controls the range of values which constitute valid administrative states for a device
type Alarm ¶
type Alarm struct {
Message string // The message or description of the alarm.
Severity AlarmSeverity // The severity level of the alarm.
Job string
Resolved bool // Indicates if the alarm is resolved.
Description string // Additional description of the alarm.
Annotations map[string]string
}
Alarm represents an alarm message from a device.
type AlarmSeverity ¶
type AlarmSeverity string
Constants for NotificationSeverity
const ( AlarmNone AlarmSeverity = "None" AlarmCritical AlarmSeverity = "Critical" AlarmMajor AlarmSeverity = "Major" AlarmMinor AlarmSeverity = "Minor" AlarmWarning AlarmSeverity = "Warning" AlarmOffline AlarmSeverity = "Offline" //for backward compatity )
func ToAlarmSeverity ¶
func ToAlarmSeverity(str string) AlarmSeverity
Function to convert a string representation to AlarmSeverity.
func (*AlarmSeverity) UnmarshalText ¶
func (a *AlarmSeverity) UnmarshalText(text []byte) error
type Application ¶
type Application struct {
DBTimestamp
Id string
Name string
Description string
OrganizationId string
Devices []Device
Layer []Layer
Latitude float64
Longitude float64
}
Device and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/Device
type ApplicationDevice ¶
type ApplicationDevice struct {
Id string
ApplicationId string
DeviceId string
Application Application
Device Device
}
type AuthMethod ¶
type AuthMethod string
AuthMethod controls the authentication method to be applied to outbound http requests for interval actions
type BaseAddress ¶
type BaseAddress struct {
// Type is used to identify the Address type, i.e., REST or MQTT
Type string
// Common properties
Host string
Port int
}
BaseAddress is a base struct contains the common fields, such as type, host, port, and so on.
type BaseReading ¶
type BinaryReading ¶
type BinaryReading struct {
BaseReading `json:",inline"`
BinaryValue []byte
MediaType string
}
func (BinaryReading) GetBaseReading ¶
func (b BinaryReading) GetBaseReading() BaseReading
Implement GetBaseReading() method in order for BinaryReading and SimpleReading, ObjectReading structs to implement the abstract Reading interface and then be used as a Reading. Also, the Reading interface can access the BaseReading fields. This is Golang's way to implement inheritance.
type BulkOperation ¶
type BulkOperation struct {
RequestId string
DeviceProfiles []DeviceProfile
Devices []Device
Relations []Link
Applications []Application
}
type BulkOperationEvent ¶
type BulkOperationEvent struct {
Action BulkOperationEventActionKind
Type string // deviceProfiles, devices, relations or applications
Success bool
Error string
Data any
}
type BulkOperationEventActionKind ¶
type BulkOperationEventActionKind string
BulkOperationEvent is a single event that the bulk process performs event can be, insert, update or delete and can be performed on deviceProfiles, devices, relations or applications
const ( BulkOperationEventActionKind_CREATE BulkOperationEventActionKind = "CREATE" BulkOperationEventActionKind_UPDATE BulkOperationEventActionKind = "UPDATE" BulkOperationEventActionKind_DELETE BulkOperationEventActionKind = "DELETE" BulkOperationEventActionKind_COMPLETED BulkOperationEventActionKind = "COMPLETED" )
type BulkOperationStatus ¶
type BulkOperationStatus struct {
Status BulkOperationStatusKind
Error string
RequestId string
Devices []GenericBulkOperationStatusUpdateEvent
DeviceProfiles []GenericBulkOperationStatusUpdateEvent
Applications []GenericBulkOperationStatusUpdateEvent
Relations []GenericBulkOperationStatusUpdateEvent
}
BulkOperationStatus
func NewBulkOperationStatusUpdateEvent ¶
func NewBulkOperationStatusUpdateEvent() BulkOperationStatus
type BulkOperationStatusKind ¶
type BulkOperationStatusKind string
const ( BulkOperationStatusKind_IN_PROGRESS BulkOperationStatusKind = "RUNNING" BulkOperationStatusKind_COMPLETED BulkOperationStatusKind = "DONE" BulkOperationStatusKind_FAILED BulkOperationStatusKind = "ERROR" )
type ChannelType ¶
type ChannelType string
ChannelType controls the range of values which constitute valid delivery types for channels
type DBTimestamp ¶
type Device ¶
type Device struct {
DBTimestamp
Id string
Name string
Description string
AdminState AdminState
OperatingState OperatingState
Protocols map[string]ProtocolProperties
Labels []string
Location interface{}
ServiceName string
Serial string
ProfileName string
AutoEvents []AutoEvent
Manufacturer string
Model string
Tags map[string]any
Properties map[string]any
}
type DeviceAlarm ¶
type DeviceAlarm struct {
Id string // Unique identifier for the update.
DeviceName string // The name or identifier of the device.
Origin int64 // The origin or source of the status update.
Alarm Alarm // The alarm information (nil if it's a status).
Status *StatusKind // status update triggered by the alarm (optional)
}
func NewDeviceAlarm ¶
func NewDeviceAlarm(deviceName string, msg string, severity AlarmSeverity, job string) DeviceAlarm
type DeviceAlarmHistory ¶
type DeviceAlarmHistory struct {
DeviceAlarm
StartAt int64
EndAt *int64
}
type DeviceCommand ¶
type DeviceHistory ¶
type DeviceHistory struct {
DBTimestamp
Version int64
Device
HistoryUser string // user who create the history record
HistoryNotes string // additional notes
HistoryType string // type of history record
HistoryDate int64 // date of history record creation
Model string
Manufacturer string
}
Device and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/Device Model fields are same as the DTOs documented by this swagger. Exceptions, if any, are noted below.
type DeviceModel ¶
type DeviceProfile ¶
type DeviceProfile struct {
DBTimestamp
Description string
Id string
Name string
Manufacturer string
Model string
Labels []string
DeviceResources []DeviceResource
DeviceCommands []DeviceCommand
}
type DeviceResource ¶
type DeviceService ¶
type DeviceService struct {
DBTimestamp
Id string
Name string
Description string
Labels []string
BaseAddress string
AdminState AdminState
}
type DeviceStatus ¶
type DeviceStatus struct {
DeviceName string // The name or identifier of the device.
Status StatusKind // The current status of the device.
Origin int64 // The origin or source of the status update.
LastUpdate int64 // The timestamp of the last status update.
AlarmCount int64 // The number of alarms associated with the device.
MaxSeverity AlarmSeverity `default:"None"` // The maximum severity level of the alarms for the device.
Silence SilenceKind `default:"None"` // The silent status of the device.
}
// DeviceStatus represents the status information of a device.
func (*DeviceStatus) UnmarshalJSON ¶
func (d *DeviceStatus) UnmarshalJSON(data []byte) error
type DiscoveredDevice ¶
type DiscoveredDevice struct {
ProfileName string
AdminState AdminState
AutoEvents []AutoEvent
Properties map[string]any
}
type EmailAddress ¶
type EmailAddress struct {
BaseAddress
Recipients []string
}
EmailAddress is an Email specific struct
func (EmailAddress) GetBaseAddress ¶
func (a EmailAddress) GetBaseAddress() BaseAddress
type Event ¶
type GenericBulkOperationStatusUpdateEvent ¶
type Interval ¶
type IntervalAction ¶
type IntervalAction struct {
DBTimestamp
Id string
Name string
IntervalName string
Content string
ContentType string
Address Address
AdminState AdminState
AuthMethod AuthMethod
}
func (*IntervalAction) UnmarshalJSON ¶
func (intervalAction *IntervalAction) UnmarshalJSON(b []byte) error
type Link ¶
type Link struct {
DBTimestamp
Id string
DeviceId string
TargetId string
Properties map[string]interface{}
Device Device
Target Device
}
Device and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/Device
type LogEntry ¶
type LogEntry struct {
Level string `bson:"logLevel,omitempty" json:"logLevel"`
Args []interface{} `bson:"args,omitempty" json:"args"`
OriginService string `bson:"originService,omitempty" json:"originService"`
Message string `bson:"message,omitempty" json:"message"`
Created int64 `bson:"created,omitempty" json:"created"`
// contains filtered or unexported fields
}
func (*LogEntry) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface for the LogEntry type
type MQTTPubAddress ¶
type MQTTPubAddress struct {
BaseAddress
Publisher string
Topic string
QoS int
KeepAlive int
Retained bool
AutoReconnect bool
ConnectTimeout int
}
MQTTPubAddress is a MQTT specific struct
func (MQTTPubAddress) GetBaseAddress ¶
func (a MQTTPubAddress) GetBaseAddress() BaseAddress
type Manufacturer ¶
type Notification ¶
type Notification struct {
DBTimestamp
Category string
Content string
ContentType string
Description string
Id string
Labels []string
Sender string
Severity NotificationSeverity
Status NotificationStatus
}
type NotificationSeverity ¶
type NotificationSeverity string
NotificationSeverity indicates the level of severity for the notification.
type NotificationStatus ¶
type NotificationStatus string
NotificationStatus indicates the current processing status of the notification.
type ObjectReading ¶
type ObjectReading struct {
BaseReading `json:",inline"`
ObjectValue interface{}
}
func (ObjectReading) GetBaseReading ¶
func (o ObjectReading) GetBaseReading() BaseReading
type OperatingState ¶
type OperatingState string
OperatingState is an indication of the operations of the device.
type Organization ¶
type Organization struct {
DBTimestamp
Id string
Name string
}
Device and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/Device
type ProtocolProperties ¶
ProtocolProperties contains the device connection information in key/value pair
type ProvisionWatcher ¶
type ProvisionWatcher struct {
DBTimestamp
Id string
Name string
ServiceName string
Labels []string
Identifiers map[string]string
BlockingIdentifiers map[string][]string
AdminState AdminState
DiscoveredDevice DiscoveredDevice
}
type RESTAddress ¶
type RESTAddress struct {
BaseAddress
Path string
HTTPMethod string
}
RESTAddress is a REST specific struct
func (RESTAddress) GetBaseAddress ¶
func (a RESTAddress) GetBaseAddress() BaseAddress
type Reading ¶
type Reading interface {
GetBaseReading() BaseReading
}
Reading is an abstract interface to be implemented by BinaryReading/SimpleReading
type ResourceOperation ¶
type ResourceProperties ¶
type SilenceKind ¶
type SilenceKind string
SilenceKind represents the kind of silence a device can have.
const ( KindNoSilence SilenceKind = "None" // The device is not silenced. KindScheduled SilenceKind = "Scheduled" // The device is silenced for a scheduled maintenance. KindOnDemand SilenceKind = "OnDemand" // The device is silenced on demand. )
func (*SilenceKind) UnmarshalText ¶
func (s *SilenceKind) UnmarshalText(text []byte) error
type SimpleReading ¶
type SimpleReading struct {
BaseReading `json:",inline"`
Value string
}
func (SimpleReading) GetBaseReading ¶
func (s SimpleReading) GetBaseReading() BaseReading
type StatusKind ¶
type StatusKind string
StatusKind represents the kind of status a device can have.
const ( KindUnknown StatusKind = "Unknown" KindOnline StatusKind = "Online" KindOffline StatusKind = "Offline" KindIdle StatusKind = "Idle" /*not used now*/ KindStandby StatusKind = "Standby" KindInactive StatusKind = "Inactive" KindMaintenance StatusKind = "Maintenance" KindBusy StatusKind = "Busy" KindUpdating StatusKind = "Updating" KindConfiguring StatusKind = "Configuring" )
func (*StatusKind) UnmarshalText ¶
func (s *StatusKind) UnmarshalText(text []byte) error
type Subscription ¶
type Subscription struct {
DBTimestamp
Categories []string
Labels []string
Channels []Address
Description string
Id string
Receiver string
Name string
ResendLimit int
ResendInterval string
AdminState AdminState
}
func (*Subscription) UnmarshalJSON ¶
func (subscription *Subscription) UnmarshalJSON(b []byte) error
type Transmission ¶
type Transmission struct {
Created int64
Id string
Channel Address
NotificationId string
SubscriptionName string
Records []TransmissionRecord
ResendCount int
Status TransmissionStatus
}
func NewTransmission ¶
func NewTransmission(subscriptionName string, channel Address, notificationId string) Transmission
NewTransmission create transmission model with required fields
func (*Transmission) UnmarshalJSON ¶
func (trans *Transmission) UnmarshalJSON(b []byte) error
type TransmissionRecord ¶
type TransmissionRecord struct {
Status TransmissionStatus
Response string
Sent int64
}
Source Files
¶
- address.go
- alarm.go
- application.go
- autoevent.go
- bulkoperation.go
- consts.go
- dbtimestamp.go
- device.go
- device_model.go
- devicecommand.go
- devicehistory.go
- deviceprofile.go
- deviceresource.go
- deviceservice.go
- devicestatus.go
- discovereddevice.go
- event.go
- interval.go
- intervalaction.go
- labels.go
- link.go
- log_entry.go
- manufacturer.go
- notification.go
- organization.go
- provisionwatcher.go
- reading.go
- resourceoperation.go
- resourceproperties.go
- subscription.go
- transmission.go
- transmissionrecord.go