models

package
v3.2.0-dev.29 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: Apache-2.0 Imports: 4 Imported by: 22

Documentation

Index

Constants

View Source
const (
	// Locked : device is locked
	// Unlocked : device is unlocked
	Locked   = "LOCKED"
	Unlocked = "UNLOCKED"
)

Constants for AdminState

View Source
const (
	Rest  = "REST"
	Email = "EMAIL"
)

Constants for ChannelType

View Source
const (
	Minor    = "MINOR"
	Critical = "CRITICAL"
	Normal   = "NORMAL"
)

Constants for NotificationSeverity

View Source
const (
	New       = "NEW"
	Processed = "PROCESSED"

	EscalationSubscriptionName = "ESCALATION"
	EscalationPrefix           = "escalated-"
	EscalatedContentNotice     = "This notification is escalated by the transmission"
)

Constants for NotificationStatus

View Source
const (
	Failed       = "FAILED"
	Sent         = "SENT"
	Acknowledged = "ACKNOWLEDGED"
	RESENDING    = "RESENDING"
)

Constants for TransmissionStatus

View Source
const (
	Up      = "UP"
	Down    = "DOWN"
	Unknown = "UNKNOWN"
)

Constants for OperatingState

View Source
const (
	TraceLog = "TRACE"
	DebugLog = "DEBUG"
	InfoLog  = "INFO"
	WarnLog  = "WARN"
	ErrorLog = "ERROR"
)

These constants identify the log levels in order of increasing severity.

View Source
const (
	Escalated = "ESCALATED"
)

Constants for both NotificationStatus and TransmissionStatus

View Source
const Halt = "HALT"

Constant for Keeper health status

Variables

This section is empty.

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 AuthMethod

type AuthMethod string

AuthMethod controls the authentication method to be applied to outbound http requests for interval actions

type AutoEvent

type AutoEvent struct {
	Interval   string
	OnChange   bool
	SourceName string
}

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 BaseReading struct {
	Id           string
	Origin       int64
	DeviceName   string
	ResourceName string
	ProfileName  string
	ValueType    string
	Units        string
	Tags         map[string]any
}

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 ChannelType

type ChannelType string

ChannelType controls the range of values which constitute valid delivery types for channels

type DBTimestamp

type DBTimestamp struct {
	Created  int64 // Created is a timestamp indicating when the entity was created.
	Modified int64 // Modified is a timestamp indicating when the entity was last modified.
}

type Device

type Device struct {
	DBTimestamp
	Id             string
	Name           string
	Parent         string
	Description    string
	AdminState     AdminState
	OperatingState OperatingState
	Protocols      map[string]ProtocolProperties
	Labels         []string
	Location       interface{}
	ServiceName    string
	ProfileName    string
	AutoEvents     []AutoEvent
	Tags           map[string]any
	Properties     map[string]any
}

type DeviceCommand

type DeviceCommand struct {
	Name               string
	IsHidden           bool
	ReadWrite          string
	ResourceOperations []ResourceOperation
	Tags               map[string]any
}

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 DeviceResource struct {
	Description string
	Name        string
	IsHidden    bool
	Properties  ResourceProperties
	Attributes  map[string]interface{}
	Tags        map[string]any
}

type DeviceService

type DeviceService struct {
	DBTimestamp
	Id          string
	Name        string
	Description string
	Labels      []string
	BaseAddress string
	AdminState  AdminState
}

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 Event struct {
	Id          string
	DeviceName  string
	ProfileName string
	SourceName  string
	Origin      int64
	Readings    []Reading
	Tags        map[string]interface{}
}

type HealthCheck

type HealthCheck struct {
	Interval string
	Path     string
	Type     string
}

type Interval

type Interval struct {
	DBTimestamp
	Id       string
	Name     string
	Start    string
	End      string
	Interval string
}

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 KVResponse

type KVResponse interface {
	SetKey(string)
}

KVResponse defines the Response Content for GET Keys of core-keeper (GET /kvs/key/{key} API).

type KVS

type KVS struct {
	Key string `json:"key,omitempty"`
	StoredData
}

KVS defines the Response Content for GET Keys controller with keyOnly is false which inherits KVResponse interface.

func (*KVS) SetKey

func (kv *KVS) SetKey(newKey string)

type KeyOnly

type KeyOnly string

KeyOnly defines the Response Content for GET Keys with keyOnly is true which inherits KVResponse interface.

func (*KeyOnly) SetKey

func (key *KeyOnly) SetKey(newKey string)

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

func (le *LogEntry) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the Unmarshaler interface for the LogEntry type

func (LogEntry) Validate

func (le LogEntry) Validate() (bool, errors.EdgeX)

Validate satisfies the Validator interface

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 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 any
}

func (ObjectReading) GetBaseReading

func (o ObjectReading) GetBaseReading() BaseReading

type OperatingState

type OperatingState string

OperatingState is an indication of the operations of the device.

type ProtocolProperties

type ProtocolProperties map[string]any

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
	InjectEdgeXAuth bool
}

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 Registration

type Registration struct {
	DBTimestamp
	ServiceId   string
	Status      string
	Host        string
	Port        int
	HealthCheck HealthCheck
}

type ResourceOperation

type ResourceOperation struct {
	DeviceResource string
	DefaultValue   string
	Mappings       map[string]string
}

type ResourceProperties

type ResourceProperties struct {
	ValueType    string
	ReadWrite    string
	Units        string
	Minimum      *float64
	Maximum      *float64
	DefaultValue string
	Mask         *uint64
	Shift        *int64
	Scale        *float64
	Offset       *float64
	Base         *float64
	Assertion    string
	MediaType    string
	Optional     map[string]any
}

type SimpleReading

type SimpleReading struct {
	BaseReading `json:",inline"`
	Value       string
}

func (SimpleReading) GetBaseReading

func (s SimpleReading) GetBaseReading() BaseReading

type StoredData

type StoredData struct {
	DBTimestamp
	Value interface{} `json:"value,omitempty"`
}

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
}

type TransmissionStatus

type TransmissionStatus string

TransmissionStatus indicates the most recent success/failure of a given transmission attempt.

Jump to

Keyboard shortcuts

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