Documentation ¶
Index ¶
- Constants
- func IsChannelType(as string) bool
- func IsNotificationsCategory(as string) bool
- func IsNotificationsSeverity(as string) bool
- func IsNotificationsStatus(as string) bool
- func IsTransmissionStatus(as string) bool
- func NewErrContractInvalid(message string) error
- type Action
- type ActionType
- type Addressable
- type AdminState
- type AutoEvent
- type CallbackAlert
- type Channel
- type ChannelType
- type Command
- type CommandResponse
- type DescribedObject
- type Device
- type DeviceProfile
- type DeviceReportdeprecated
- type DeviceResource
- type DeviceService
- type EncryptionDetails
- type ErrContractInvalid
- type Event
- type Filter
- type Get
- type Interval
- type IntervalAction
- type LogEntry
- type Notification
- type NotificationsCategory
- type NotificationsSeverity
- type NotificationsStatus
- type NotifyUpdate
- type OperatingState
- type Operation
- type ProfileProperty
- type ProfileResource
- type PropertyValue
- type ProtocolProperties
- type ProvisionWatcher
- type Put
- type Reading
- type Registration
- type ResourceOperation
- type Response
- type Subscription
- type Timestamps
- type Transmission
- type TransmissionRecord
- type TransmissionStatus
- type Units
- type Validator
- type ValueDescriptor
Constants ¶
const ( PROFILE ActionType = "PROFILE" DEVICE = "DEVICE" SERVICE = "SERVICE" SCHEDULE = "SCHEDULE" SCHEDULEEVENT = "SCHEDULEEVENT" ADDRESSABLE = "ADDRESSABLE" VALUEDESCRIPTOR = "VALUEDESCRIPTOR" PROVISIONWATCHER = "PROVISIONWATCHER" REPORT = "REPORT" )
const ( // Locked : device is locked // Unlocked : device is unlocked Locked = "LOCKED" Unlocked = "UNLOCKED" )
const ( Security = "SECURITY" Hwhealth = "HW_HEALTH" Swhealth = "SW_HEALTH" )
const ( Rest = "REST" Email = "EMAIL" )
const ( EncNone = "NONE" EncAes = "AES" )
Encryption types
const ( TraceLog = "TRACE" DebugLog = "DEBUG" InfoLog = "INFO" WarnLog = "WARN" ErrorLog = "ERROR" )
These constants identify the log levels in order of increasing severity.
const ( Enabled = "ENABLED" Disabled = "DISABLED" )
Enabled : ENABLED Disabled : DISABLED
const ( // Base64Encoding : the float value is represented in Base64 encoding Base64Encoding = "Base64" // ENotation : the float value is represented in eNotation ENotation = "eNotation" )
const ( DestMQTT = "MQTT_TOPIC" DestZMQ = "ZMQ_TOPIC" DestIotCoreMQTT = "IOTCORE_TOPIC" DestAzureMQTT = "AZURE_TOPIC" DestRest = "REST_ENDPOINT" DestXMPP = "XMPP_TOPIC" DestAWSMQTT = "AWS_TOPIC" DestInfluxDB = "INFLUXDB_ENDPOINT" )
Export destination types
const ( CompNone = "NONE" CompGzip = "GZIP" CompZip = "ZIP" )
Compression algorithm types
const ( FormatJSON = "JSON" FormatXML = "XML" FormatSerialized = "SERIALIZED" FormatIoTCoreJSON = "IOTCORE_JSON" FormatAzureJSON = "AZURE_JSON" FormatAWSJSON = "AWS_JSON" FormatCSV = "CSV" FormatThingsBoardJSON = "THINGSBOARD_JSON" FormatNOOP = "NOOP" )
Data format types
const ( NotifyUpdateAdd = "add" NotifyUpdateUpdate = "update" NotifyUpdateDelete = "delete" )
const ( Critical = "CRITICAL" Normal = "NORMAL" )
const ( New = "NEW" Processed = "PROCESSED" Escalated = "ESCALATED" )
const ( Failed = "FAILED" Sent = "SENT" Acknowledged = "ACKNOWLEDGED" Trxescalated = "TRXESCALATED" )
const (
ValidateTag = "validate"
)
Variables ¶
This section is empty.
Functions ¶
func IsChannelType ¶
IsChannelType allows external code to verify whether the supplied string is a valid ChannelType value
func IsNotificationsCategory ¶
IsNotificationsCategory allows external code to verify whether the supplied string is a valid NotificationsCategory value
func IsNotificationsSeverity ¶
func IsNotificationsStatus ¶
func IsTransmissionStatus ¶
func NewErrContractInvalid ¶
NewErrContractInvalid returns an instance of the error interface with ErrContractInvalid as its implementation.
Types ¶
type Action ¶
type Action struct { Path string `json:"path" yaml:"path,omitempty"` // Path used by service for action on a device or sensor Responses []Response `json:"responses" yaml:"responses,omitempty"` // Responses from get or put requests to service URL string `json:"url,omitempty" yaml:"url,omitempty"` // Url for requests from command service }
Action describes state related to the capabilities of a device
type Addressable ¶
type Addressable struct { Timestamps Id string `json:"id"` // ID is a unique identifier for the Addressable, such as a UUID Name string `json:"name"` // Name is a unique name given to the Addressable Protocol string `json:"protocol"` // Protocol for the address (HTTP/TCP) HTTPMethod string `json:"method"` // Method for connecting (i.e. POST) Address string `json:"address"` // Address of the addressable Port int `json:"port,Number"` // Port for the address Path string `json:"path"` // Path for callbacks Publisher string `json:"publisher"` // For message bus protocols User string `json:"user"` // User id for authentication Password string `json:"password"` // Password of the user for authentication for the addressable Topic string `json:"topic"` // Topic for message bus addressables // contains filtered or unexported fields }
Addressable holds information indicating how to contact a specific endpoint
func (Addressable) GetBaseURL ¶
func (a Addressable) GetBaseURL() string
GetBaseURL returns a base URL consisting of protocol, host and port as a string assembled from the constituent parts of the Addressable
func (Addressable) GetCallbackURL ¶
func (a Addressable) GetCallbackURL() string
GetCallbackURL() returns the callback url for the addressable if all relevant tokens have values. If any token is missing, string will be empty. Tokens include protocol, address, port and path.
func (Addressable) MarshalJSON ¶
func (a Addressable) MarshalJSON() ([]byte, error)
Custom marshaling for JSON Create the URL and Base URL Treat the strings as pointers so they can be null in JSON
func (*Addressable) UnmarshalJSON ¶
func (a *Addressable) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the Addressable type
func (Addressable) Validate ¶
func (a Addressable) Validate() (bool, error)
Validate satisfies the Validator interface
type AdminState ¶
type AdminState string
AdminState controls the range of values which constitute valid administrative states for a device
func GetAdminState ¶
func GetAdminState(as string) (AdminState, bool)
GetAdminState is called from within the router logic of the core services. For example, there are PUT calls like the one below from core-metadata which specify their update parameters in the URL
d.HandleFunc("/{"+ID+"}/"+URLADMINSTATE+"/{"+ADMINSTATE+"}", restSetDeviceAdminStateById).Methods(http.MethodPut)
Updates like this should be refactored to pass a body containing the new values instead of via the URL. This would allow us to utilize the model validation above and remove the logic from the controller.
This will be removed once work on the following issue begins -- https://github.com/edgexfoundry/edgex-go/issues/1244
func (*AdminState) UnmarshalJSON ¶
func (as *AdminState) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the enum type
func (AdminState) Validate ¶
func (as AdminState) Validate() (bool, error)
Validate satisfies the Validator interface
type AutoEvent ¶
type AutoEvent struct { // Frequency indicates how often the specific resource needs to be polled. // It represents as a duration string. // The format of this field is to be an unsigned integer followed by a unit which may be "ms", "s", "m" or "h" // representing milliseconds, seconds, minutes or hours. Eg, "100ms", "24h" Frequency string `json:"frequency,omitempty"` // OnChange indicates whether the device service will generate an event only, // if the reading value is different from the previous one. // If true, only generate events when readings change OnChange bool `json:"onChange,omitempty"` // Resource indicates the name of the resource in the device profile which describes the event to generate Resource string `json:"resource,omitempty"` }
AutoEvent supports auto-generated events sourced from a device service
type CallbackAlert ¶
type CallbackAlert struct { ActionType ActionType `json:"type"` Id string `json:"id"` }
CallbackAlert indicates an action to take when a callback fires.
func (CallbackAlert) MarshalJSON ¶
func (ca CallbackAlert) MarshalJSON() ([]byte, error)
Custom JSON marshaling to turn empty strings into null pointers
func (CallbackAlert) String ¶
func (ca CallbackAlert) String() string
* String function for representing a CallbackAlert
type Channel ¶
type Channel struct { Type ChannelType `json:"type,omitempty"` // Type indicates whether the channel facilitates email or REST MailAddresses []string `json:"mailAddresses,omitempty"` // MailAddresses contains email addresses Url string `json:"url,omitempty"` // URL contains a REST API destination }
Channel supports transmissions and notifications with fields for delivery via email or REST
type ChannelType ¶
type ChannelType string
ChannelType controls the range of values which constitute valid delivery types for channels
func (*ChannelType) UnmarshalJSON ¶
func (as *ChannelType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the type
type Command ¶
type Command struct { Timestamps `yaml:",inline"` Id string `json:"id" yaml:"id,omitempty"` // Id is a unique identifier, such as a UUID Name string `json:"name" yaml:"name,omitempty"` // Command name (unique on the profile) Get Get `json:"get" yaml:"get,omitempty"` // Get Command Put Put `json:"put" yaml:"put,omitempty"` // Put Command // contains filtered or unexported fields }
Command defines a specific read/write operation targeting a device
func (*Command) AllAssociatedValueDescriptors ¶
AllAssociatedValueDescriptors will append all the associated value descriptors to the list associated by PUT command parameters and PUT/GET command return values
func (Command) MarshalJSON ¶
MarshalJSON implements the Marshaler interface. Empty strings will be null.
func (*Command) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface for the Command type
type CommandResponse ¶
type CommandResponse struct { Id string `json:"id"` // Id uniquely identifies the CommandResponse, UUID for example. Name string `json:"name"` // Unique name for identifying a device AdminState AdminState `json:"adminState"` // Admin state (locked/unlocked) OperatingState OperatingState `json:"operatingState"` // Operating state (enabled/disabled) LastConnected int64 `json:"lastConnected"` // Time (milliseconds) that the device last provided any feedback or responded to any request LastReported int64 `json:"lastReported"` // Time (milliseconds) that the device reported data to the core microservice Labels []string `json:"labels"` // Other labels applied to the device to help with searching Location interface{} `json:"location"` // Device service specific location (interface{} is an empty interface so it can be anything) Commands []Command `json:"commands"` // Associated Device Profile - Describes the device }
CommandResponse identifies a specific device along with its supported commands.
func CommandResponseFromDevice ¶
func CommandResponseFromDevice(d Device, commands []Command, cmdURL string) CommandResponse
* CommandResponseFromDevice will create a CommandResponse struct from the supplied Device struct
func (CommandResponse) MarshalJSON ¶
func (cr CommandResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the Marshaler interface for custom marshaling to make empty strings null
func (CommandResponse) String ¶
func (d CommandResponse) String() string
* String function for representing a device
type DescribedObject ¶
type DescribedObject struct { Timestamps `yaml:",inline"` Description string `json:"description" yaml:"description,omitempty"` // Description. Capicé? }
DescribedObject is a hold-over from the Java conversion and is supposed to represent inheritance whereby a type with a Description property IS A DescribedObject. However since there is no inheritance in Go, this should be eliminated and the Description property moved to the relevant types. 4 types currently use this.
func (DescribedObject) String ¶
func (o DescribedObject) String() string
* String function for DescribedObject
type Device ¶
type Device struct { DescribedObject Id string `json:"id"` // ID uniquely identifies the device, a UUID for example Name string `json:"name"` // Unique name for identifying a device AdminState AdminState `json:"adminState"` // Admin state (locked/unlocked) OperatingState OperatingState `json:"operatingState"` // Operating state (enabled/disabled) Protocols map[string]ProtocolProperties `json:"protocols"` // A map of supported protocols for the given device LastConnected int64 `json:"lastConnected"` // Time (milliseconds) that the device last provided any feedback or responded to any request LastReported int64 `json:"lastReported"` // Time (milliseconds) that the device reported data to the core microservice Labels []string `json:"labels"` // Other labels applied to the device to help with searching Location interface{} `json:"location"` // Device service specific location (interface{} is an empty interface so it can be anything) Service DeviceService `json:"service"` // Associated Device Service - One per device Profile DeviceProfile `json:"profile"` // Associated Device Profile - Describes the device AutoEvents []AutoEvent `json:"autoEvents"` // A list of auto-generated events coming from the device // contains filtered or unexported fields }
Device represents a registered device participating within the EdgeX Foundry ecosystem
func (*Device) AllAssociatedValueDescriptors ¶
AllAssociatedValueDescriptors returns all the associated value descriptors through Put command parameters and Put/Get command return values
func (Device) MarshalJSON ¶
MarshalJSON implements the Marshaler interface in order to make empty strings null
func (*Device) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface for the Device type
type DeviceProfile ¶
type DeviceProfile struct { DescribedObject `yaml:",inline"` Id string `json:"id" yaml:"id,omitempty"` Name string `json:"name" yaml:"name,omitempty"` // Non-database identifier (must be unique) Manufacturer string `json:"manufacturer" yaml:"manufacturer,omitempty"` // Manufacturer of the device Model string `json:"model" yaml:"model,omitempty"` // Model of the device Labels []string `json:"labels" yaml:"labels,flow,omitempty"` // Labels used to search for groups of profiles DeviceResources []DeviceResource `json:"deviceResources" yaml:"deviceResources,omitempty"` DeviceCommands []ProfileResource `json:"deviceCommands" yaml:"deviceCommands,omitempty"` CoreCommands []Command `json:"coreCommands" yaml:"coreCommands,omitempty"` // List of commands to Get/Put information for devices associated with this profile // contains filtered or unexported fields }
DeviceProfile represents the attributes and operational capabilities of a device. It is a template for which there can be multiple matching devices within a given system.
func (DeviceProfile) MarshalJSON ¶
func (dp DeviceProfile) MarshalJSON() ([]byte, error)
MarshalJSON implements the Marshaler interface so that empty strings and arrays are null
func (DeviceProfile) String ¶
func (dp DeviceProfile) String() string
* To String function for DeviceProfile
func (*DeviceProfile) UnmarshalJSON ¶
func (dp *DeviceProfile) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the DeviceProfile type
func (DeviceProfile) Validate ¶
func (dp DeviceProfile) Validate() (bool, error)
Validate satisfies the Validator interface
type DeviceReport
deprecated
type DeviceReport struct { Timestamps Id string `json:"id"` Name string `json:"name"` // non-database identifier for a device report - must be unique Device string `json:"device"` // associated device name - should be a valid and unique device name Action string `json:"action"` // associated interval action name - should be a valid and unique interval action name Expected []string `json:"expected"` // array of value descriptor names describing the types of data captured in the report }
Deprecated: DeviceReport isn't utilized and needs to be removed.
func (DeviceReport) MarshalJSON ¶
func (dr DeviceReport) MarshalJSON() ([]byte, error)
Custom marshaling to make empty strings null
func (DeviceReport) String ¶
func (dr DeviceReport) String() string
* To String function for DeviceProfile
type DeviceResource ¶
type DeviceResource struct { Description string `json:"description" yaml:"description,omitempty"` Name string `json:"name" yaml:"name,omitempty"` Tag string `json:"tag" yaml:"tag,omitempty"` Properties ProfileProperty `json:"properties" yaml:"properties"` Attributes map[string]string `json:"attributes" yaml:"attributes,omitempty"` }
DeviceResource represents a value on a device that can be read or written
func (DeviceResource) MarshalJSON ¶
func (do DeviceResource) MarshalJSON() ([]byte, error)
MarshalJSON implements the Marshaler interface in order to make empty strings null
func (DeviceResource) String ¶
func (do DeviceResource) String() string
* To String function for DeviceResource
type DeviceService ¶
type DeviceService struct { DescribedObject Id string `json:"id"` Name string `json:"name"` // time in milliseconds that the device last provided any feedback or responded to any request LastConnected int64 `json:"lastConnected"` // time in milliseconds that the device last reported data to the core LastReported int64 `json:"lastReported"` // operational state - either enabled or disabled OperatingState OperatingState `json:"operatingState"` // operational state - ether enabled or disableddc Labels []string `json:"labels"` // tags or other labels applied to the device service for search or other identification needs Addressable Addressable `json:"addressable"` // address (MQTT topic, HTTP address, serial bus, etc.) for reaching the service AdminState AdminState `json:"adminState"` // Device Service Admin State // contains filtered or unexported fields }
DeviceService represents a service that is responsible for proxying connectivity between a set of devices and the EdgeX Foundry core services.
func (DeviceService) MarshalJSON ¶
func (ds DeviceService) MarshalJSON() ([]byte, error)
MarshalJSON implements the Marshaler interface in order to make empty strings null
func (DeviceService) String ¶
func (ds DeviceService) String() string
* To String function for DeviceService
func (*DeviceService) UnmarshalJSON ¶
func (ds *DeviceService) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the DeviceService type
func (DeviceService) Validate ¶
func (ds DeviceService) Validate() (bool, error)
Validate satisfies the Validator interface
type EncryptionDetails ¶
type EncryptionDetails struct { Algo string `json:"encryptionAlgorithm,omitempty"` Key string `json:"encryptionKey,omitempty"` InitVector string `json:"initializingVector,omitempty"` }
EncryptionDetails - Provides details for encryption of export data per client request
type ErrContractInvalid ¶
type ErrContractInvalid struct {
// contains filtered or unexported fields
}
ErrContractInvalid is a specific error type for handling model validation failures. Type checking within the calling application will facilitate more explicit error handling whereby it's clear that validation has failed as opposed to something unexpected happening.
func (ErrContractInvalid) Error ¶
func (e ErrContractInvalid) Error() string
Error fulfills the error interface and returns an error message assembled from the state of ErrContractInvalid.
type Event ¶
type Event struct { ID string `json:"id" codec:"id,omitempty"` // ID uniquely identifies an event, for example a UUID Pushed int64 `json:"pushed" codec:"pushed,omitempty"` // Pushed is a timestamp indicating when the event was exported. If unexported, the value is zero. Device string `json:"device" codec:"device,omitempty"` // Device identifies the source of the event, can be a device name or id. Usually the device name. Created int64 `json:"created" codec:"created,omitempty"` // Created is a timestamp indicating when the event was created. Modified int64 `json:"modified" codec:"modified,omitempty"` // Modified is a timestamp indicating when the event was last modified. Origin int64 `json:"origin" codec:"origin,omitempty"` // Origin is a timestamp that can communicate the time of the original reading, prior to event creation Readings []Reading `json:"readings" codec:"readings,omitempty"` // Readings will contain zero to many entries for the associated readings of a given event. // contains filtered or unexported fields }
Event represents a single measurable event read from a device
func (Event) MarshalJSON ¶
MarshalJSON implements the Marshaler interface in order to make empty strings null
func (*Event) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface for the Event type
type Filter ¶
type Filter struct { DeviceIDs []string `json:"deviceIdentifiers,omitempty"` ValueDescriptorIDs []string `json:"valueDescriptorIdentifiers,omitempty"` }
Filter - Specifies the client filters on reading data
type Get ¶
type Get struct {
Action `yaml:",inline"`
}
func (*Get) AllAssociatedValueDescriptors ¶
Append the associated value descriptors to the list
func (Get) MarshalJSON ¶
Custom marshaling to make empty strings and arrays null
type Interval ¶
type Interval struct { Timestamps Timestamps ID string `json:"id"` Name string `json:"name"` // non-database identifier for a shcedule (*must be quitue) Start string `json:"start"` // Start time i ISO 8601 format YYYYMMDD'T'HHmmss @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyymmdd'T'HHmmss") End string `json:"end"` // Start time i ISO 8601 format YYYYMMDD'T'HHmmss @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyymmdd'T'HHmmss") Frequency string `json:"frequency"` // how frequently should the event occur according ISO 8601 Cron string `json:"cron"` // cron styled regular expression indicating how often the action under interval should occur. Use either runOnce, frequency or cron and not all. RunOnce bool `json:"runOnce"` // boolean indicating that this interval runs one time - at the time indicated by the start // contains filtered or unexported fields }
Interval a period of time
func (Interval) MarshalJSON ¶
Custom marshaling to make empty strings null
func (*Interval) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface for the Interval type
type IntervalAction ¶
type IntervalAction struct { ID string `json:"id"` Created int64 `json:"created"` Modified int64 `json:"modified"` Origin int64 `json:"origin"` Name string `json:"name"` Interval string `json:"interval"` Parameters string `json:"parameters"` Target string `json:"target"` Protocol string `json:"protocol"` HTTPMethod string `json:"httpMethod"` Address string `json:"address"` Port int `json:"port"` Path string `json:"path"` Publisher string `json:"publisher"` User string `json:"user"` Password string `json:"password"` Topic string `json:"topic"` // contains filtered or unexported fields }
func (IntervalAction) GetBaseURL ¶
func (ia IntervalAction) GetBaseURL() string
func (IntervalAction) MarshalJSON ¶
func (ia IntervalAction) MarshalJSON() ([]byte, error)
func (IntervalAction) String ¶
func (ia IntervalAction) String() string
func (*IntervalAction) UnmarshalJSON ¶
func (ia *IntervalAction) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the IntervalAction type
func (IntervalAction) Validate ¶
func (ia IntervalAction) Validate() (bool, error)
Validate satisfies the Validator interface
type LogEntry ¶
type LogEntry struct { Level string `bson:"logLevel" json:"logLevel"` Args []interface{} `bson:"args" json:"args"` OriginService string `bson:"originService" json:"originService"` Message string `bson:"message" json:"message"` Created int64 `bson:"created" json:"created"` // contains filtered or unexported fields }
func (LogEntry) MarshalJSON ¶
func (*LogEntry) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface for the LogEntry type
type Notification ¶
type Notification struct { Timestamps ID string `json:"id,omitempty"` Slug string `json:"slug,omitempty"` Sender string `json:"sender,omitempty"` Category NotificationsCategory `json:"category,omitempty"` Severity NotificationsSeverity `json:"severity,omitempty"` Content string `json:"content,omitempty"` Description string `json:"description,omitempty"` Status NotificationsStatus `json:"status,omitempty"` Labels []string `json:"labels,omitempty"` ContentType string `json:"contenttype,omitempty"` // contains filtered or unexported fields }
func (Notification) MarshalJSON ¶
func (n Notification) MarshalJSON() ([]byte, error)
func (Notification) String ¶
func (n Notification) String() string
* To String function for Notification Struct
func (*Notification) UnmarshalJSON ¶ added in v0.1.23
func (n *Notification) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the Notification type
func (Notification) Validate ¶ added in v0.1.23
func (n Notification) Validate() (bool, error)
Validate satisfies the Validator interface
type NotificationsCategory ¶
type NotificationsCategory string
NotificationsCategory controls the range of values which constitute valid categories for notifications
func (*NotificationsCategory) UnmarshalJSON ¶
func (as *NotificationsCategory) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the type
type NotificationsSeverity ¶
type NotificationsSeverity string
func (*NotificationsSeverity) UnmarshalJSON ¶
func (as *NotificationsSeverity) UnmarshalJSON(data []byte) error
type NotificationsStatus ¶
type NotificationsStatus string
func (*NotificationsStatus) UnmarshalJSON ¶
func (as *NotificationsStatus) UnmarshalJSON(data []byte) error
type NotifyUpdate ¶
type NotifyUpdate struct { Name string `json:"name"` Operation string `json:"operation"` // contains filtered or unexported fields }
func (*NotifyUpdate) UnmarshalJSON ¶
func (n *NotifyUpdate) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the NotifyUpdate type
func (NotifyUpdate) Validate ¶
func (n NotifyUpdate) Validate() (bool, error)
Validate satisfies the Validator interface
type OperatingState ¶
type OperatingState string
OperatingState Constant String
func GetOperatingState ¶
func GetOperatingState(os string) (OperatingState, bool)
GetOperatingState is called from within the router logic of the core services. For example, there are PUT calls like the one below from core-metadata which specify their update parameters in the URL
d.HandleFunc("/{"+ID+"}/"+OPSTATE+"/{"+OPSTATE+"}", restSetDeviceOpStateById).Methods(http.MethodPut)
Updates like this should be refactored to pass a body containing the new values instead of via the URL. This would allow us to utilize the model validation above and remove the logic from the controller.
This will be removed once work on the following issue begins -- https://github.com/edgexfoundry/edgex-go/issues/1244
func (*OperatingState) UnmarshalJSON ¶
func (os *OperatingState) UnmarshalJSON(data []byte) error
UnmarshalJSON : Struct into json
func (OperatingState) Validate ¶
func (os OperatingState) Validate() (bool, error)
Validate satisfies the Validator interface
type Operation ¶
type Operation struct { Action string `bson:"action" json:"action,omitempty"` Services []string `bson:"services,omitempty" json:"services,omitempty"` }
* An Operation for SMA processing. * * * Operation struct
func (*Operation) UnmarshalJSON ¶
Implements unmarshaling of JSON string to Operation type instance
type ProfileProperty ¶
type ProfileProperty struct { Value PropertyValue `json:"value"` Units Units `json:"units"` }
func (ProfileProperty) String ¶
func (pp ProfileProperty) String() string
* To String function for DeviceService
type ProfileResource ¶
type ProfileResource struct { Name string `json:"name" yaml:"name,omitempty"` Get []ResourceOperation `json:"get" yaml:"get,omitempty"` Set []ResourceOperation `json:"set" yaml:"set,omitempty"` }
func (ProfileResource) MarshalJSON ¶
func (pr ProfileResource) MarshalJSON() ([]byte, error)
Custom marshaling to make empty strings null
func (ProfileResource) String ¶
func (pr ProfileResource) String() string
* To String function for Profile Resource
type PropertyValue ¶
type PropertyValue struct { Type string `json:"type" yaml:"type,omitempty"` // ValueDescriptor Type of property after transformations ReadWrite string `json:"readWrite" yaml:"readWrite,omitempty"` // Read/Write Permissions set for this property Minimum string `json:"minimum" yaml:"minimum,omitempty"` // Minimum value that can be get/set from this property Maximum string `json:"maximum" yaml:"maximum,omitempty"` // Maximum value that can be get/set from this property DefaultValue string `json:"defaultValue" yaml:"defaultValue,omitempty"` // Default value set to this property if no argument is passed Size string `json:"size" yaml:"size,omitempty"` // Size of this property in its type (i.e. bytes for numeric types, characters for string types) Mask string `json:"mask" yaml:"mask,omitempty"` // Mask to be applied prior to get/set of property Shift string `json:"shift" yaml:"shift,omitempty"` // Shift to be applied after masking, prior to get/set of property Scale string `json:"scale" yaml:"scale,omitempty"` // Multiplicative factor to be applied after shifting, prior to get/set of property Offset string `json:"offset" yaml:"offset,omitempty"` // Additive factor to be applied after multiplying, prior to get/set of property Base string `json:"base" yaml:"base,omitempty"` // Base for property to be applied to, leave 0 for no power operation (i.e. base ^ property: 2 ^ 10) Assertion string `json:"assertion" yaml:"assertion,omitempty"` // Required value of the property, set for checking error state. Failing an assertion condition will mark the device with an error state Precision string `json:"precision" yaml:"precision,omitempty"` FloatEncoding string `json:"floatEncoding" yaml:"floatEncoding,omitempty"` // FloatEncoding indicates the representation of floating value of reading. It should be 'Base64' or 'eNotation' MediaType string `json:"mediaType,omitempty"` }
func (PropertyValue) MarshalJSON ¶
func (pv PropertyValue) MarshalJSON() ([]byte, error)
Custom marshaling to make empty strings null
func (PropertyValue) String ¶
func (pv PropertyValue) String() string
* To String function for DeviceService
type ProtocolProperties ¶
ProtocolProperties contains the device connection information in key/value pair
type ProvisionWatcher ¶
type ProvisionWatcher struct { Timestamps Id string `json:"id"` Name string `json:"name"` // unique name and identifier of the provision watcher Identifiers map[string]string `json:"identifiers"` // set of key value pairs that identify property (MAC, HTTP,...) and value to watch for (00-05-1B-A1-99-99, 10.0.0.1,...) BlockingIdentifiers map[string][]string `json:"blockingidentifiers"` // set of key-values pairs that identify devices which will not be added despite matching on Identifiers Profile DeviceProfile `json:"profile"` // device profile that should be applied to the devices available at the identifier addresses Service DeviceService `json:"service"` // device service that new devices will be associated to AdminState AdminState `json:"adminState"` // administrative state for new devices - either unlocked or locked OperatingState OperatingState `validate:"-"` // Deprecated: exists for historical compatibility and will be ignored // contains filtered or unexported fields }
func (ProvisionWatcher) MarshalJSON ¶
func (pw ProvisionWatcher) MarshalJSON() ([]byte, error)
Custom marshaling to make empty strings null
func (ProvisionWatcher) String ¶
func (pw ProvisionWatcher) String() string
* To String function for ProvisionWatcher
func (*ProvisionWatcher) UnmarshalJSON ¶
func (pw *ProvisionWatcher) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the ProvisionWatcher type
func (ProvisionWatcher) Validate ¶
func (pw ProvisionWatcher) Validate() (bool, error)
Validate satisfies the Validator interface
type Put ¶
type Put struct { Action `yaml:",inline"` ParameterNames []string `json:"parameterNames" yaml:"parameterNames,omitempty"` }
* This file is the model for Put commands in EdgeX * * Put Struct
func (*Put) AllAssociatedValueDescriptors ¶
Append the associated value descriptors to the list
func (Put) MarshalJSON ¶
Custom marshaling to make empty strings null
type Reading ¶
type Reading struct { Id string `json:"id" codec:"id,omitempty"` Pushed int64 `json:"pushed" codec:"pushed,omitempty"` // When the data was pushed out of EdgeX (0 - not pushed yet) Created int64 `json:"created" codec:"created,omitempty"` // When the reading was created Origin int64 `json:"origin" codec:"origin,omitempty"` Modified int64 `json:"modified" codec:"modified,omitempty"` Device string `json:"device" codec:"device,omitempty"` Name string `json:"name" codec:"name,omitempty"` Value string `json:"value" codec:"value,omitempty"` // Device sensor data value BinaryValue []byte `json:"binaryValue" codec:"binaryValue,omitempty"` // Binary data payload // contains filtered or unexported fields }
func (Reading) MarshalJSON ¶
Custom marshaling to make empty strings null
func (*Reading) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface for the Reading type
type Registration ¶
type Registration struct { ID string `json:"id,omitempty"` Created int64 `json:"created"` Modified int64 `json:"modified"` Origin int64 `json:"origin"` Name string `json:"name,omitempty"` Addressable Addressable `json:"addressable,omitempty"` Format string `json:"format,omitempty"` Filter Filter `json:"filter,omitempty"` Encryption EncryptionDetails `json:"encryption,omitempty"` Compression string `json:"compression,omitempty"` Enable bool `json:"enable"` Destination string `json:"destination,omitempty"` // contains filtered or unexported fields }
Registration - Defines the registration details on the part of north side export clients
func (*Registration) UnmarshalJSON ¶
func (r *Registration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the DeviceService type
func (Registration) Validate ¶
func (reg Registration) Validate() (bool, error)
Validate satisfies the Validator interface
type ResourceOperation ¶
type ResourceOperation struct { Index string `json:"index" yaml:"index,omitempty"` Operation string `json:"operation" yaml:"operation,omitempty"` Object string `json:"object" yaml:"object,omitempty"` // Deprecated DeviceResource string `json:"deviceResource" yaml:"deviceResource,omitempty"` // The replacement of Object field Parameter string `json:"parameter" yaml:"parameter,omitempty"` Resource string `json:"resource" yaml:"resource,omitempty"` // Deprecated DeviceCommand string `json:"deviceCommand" yaml:"deviceCommand,omitempty"` // The replacement of Resource field Secondary []string `json:"secondary" yaml:"secondary,omitempty"` Mappings map[string]string `json:"mappings" yaml:"mappings,omitempty"` // contains filtered or unexported fields }
func (ResourceOperation) MarshalJSON ¶
func (ro ResourceOperation) MarshalJSON() ([]byte, error)
Custom marshaling to make empty strings null
func (ResourceOperation) String ¶
func (ro ResourceOperation) String() string
* To String function for ResourceOperation
func (*ResourceOperation) UnmarshalJSON ¶ added in v0.1.16
func (ro *ResourceOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the ResourceOperation type
func (ResourceOperation) Validate ¶ added in v0.1.16
func (ro ResourceOperation) Validate() (bool, error)
Validate satisfies the Validator interface
type Response ¶
type Response struct { Code string `json:"code" yaml:"code,omitempty"` Description string `json:"description" yaml:"description,omitempty"` ExpectedValues []string `json:"expectedValues" yaml:"expectedValues,omitempty"` }
* Response for a Get or Put request to a service * * * Response Struct
func (Response) MarshalJSON ¶
Custom marshalling to make empty strings null
type Subscription ¶
type Subscription struct { Timestamps ID string `json:"id"` Slug string `json:"slug,omitempty"` Receiver string `json:"receiver,omitempty"` Description string `json:"description,omitempty"` SubscribedCategories []NotificationsCategory `json:"subscribedCategories,omitempty"` SubscribedLabels []string `json:"subscribedLabels,omitempty"` Channels []Channel `json:"channels,omitempty"` }
* A subscription for notification alerts * * * Subscription struct
func (Subscription) MarshalJSON ¶
func (s Subscription) MarshalJSON() ([]byte, error)
Custom marshaling to make empty strings null
func (Subscription) String ¶
func (s Subscription) String() string
* To String function for Notification Struct
type Timestamps ¶
type Timestamps struct { Created int64 `json:"created,omitempty" yaml:"created,omitempty"` Modified int64 `json:"modified,omitempty" yaml:"modified,omitempty"` Origin int64 `json:"origin,omitempty" yaml:"origin,omitempty"` }
func (*Timestamps) String ¶
func (o *Timestamps) String() string
* String function for representing a device
type Transmission ¶
type Transmission struct { Timestamps ID string `json:"id"` Notification Notification `json:"notification"` Receiver string `json:"receiver,omitempty"` Channel Channel `json:"channel,omitempty"` Status TransmissionStatus `json:"status,omitempty"` ResendCount int `json:"resendcount"` Records []TransmissionRecord `json:"records,omitempty"` // contains filtered or unexported fields }
func (Transmission) MarshalJSON ¶
func (t Transmission) MarshalJSON() ([]byte, error)
Custom marshaling to make empty strings null
func (Transmission) String ¶
func (t Transmission) String() string
* To String function for Transmission Struct
func (*Transmission) UnmarshalJSON ¶ added in v0.1.18
func (t *Transmission) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the Transmission type
func (Transmission) Validate ¶ added in v0.1.18
func (t Transmission) Validate() (bool, error)
Validate satisfies the Validator interface
type TransmissionRecord ¶
type TransmissionRecord struct { Status TransmissionStatus `json:"status"` Response string `json:"response"` Sent int64 `json:"sent"` }
func (TransmissionRecord) MarshalJSON ¶
func (t TransmissionRecord) MarshalJSON() ([]byte, error)
Custom marshaling to make empty strings null
func (TransmissionRecord) String ¶
func (t TransmissionRecord) String() string
* To String function for TransmissionRecord Struct
type TransmissionStatus ¶
type TransmissionStatus string
func (*TransmissionStatus) UnmarshalJSON ¶
func (as *TransmissionStatus) UnmarshalJSON(data []byte) error
* Unmarshal the enum type
func (TransmissionStatus) Validate ¶ added in v0.1.18
func (as TransmissionStatus) Validate() (bool, error)
type Units ¶
type Units struct { Type string `json:"type" yaml:"type,omitempty"` ReadWrite string `json:"readWrite" yaml:"readWrite,omitempty"` DefaultValue string `json:"defaultValue" yaml:"defaultValue,omitempty"` }
func (Units) MarshalJSON ¶
Custom marshaling to make empty strings null
type Validator ¶
type Validator interface { // Validate performs integrity checks on the internal state of the model. It returns a boolean indicating whether // the validation passed or not, and the associated error if validation was unsuccessful. Validate() (bool, error) }
Validator provides an interface for struct types to implement validation of their internal state. They can also indicate to a caller whether their validation has already been completed.
NOTE: This cannot be applied to struct types that are simply aliased to a primitive.
type ValueDescriptor ¶
type ValueDescriptor struct { Id string `json:"id"` Created int64 `json:"created"` Description string `json:"description"` Modified int64 `json:"modified"` Origin int64 `json:"origin"` Name string `json:"name"` Min interface{} `json:"min"` Max interface{} `json:"max"` DefaultValue interface{} `json:"defaultValue"` Type string `json:"type"` UomLabel string `json:"uomLabel"` Formatting string `json:"formatting"` Labels []string `json:"labels"` MediaType string `json:"mediaType"` FloatEncoding string `json:"floatEncoding"` // contains filtered or unexported fields }
* Value Descriptor Struct
func From ¶ added in v0.1.11
func From(dr DeviceResource) ValueDescriptor
From creates a ValueDescriptor based on the information provided in the DeviceResource.
func (ValueDescriptor) MarshalJSON ¶
func (v ValueDescriptor) MarshalJSON() ([]byte, error)
Custom marshaling to make empty strings null
func (ValueDescriptor) String ¶
func (a ValueDescriptor) String() string
* To String function for ValueDescriptor Struct
func (*ValueDescriptor) UnmarshalJSON ¶
func (v *ValueDescriptor) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the Unmarshaler interface for the ValueDescriptor type
func (ValueDescriptor) Validate ¶
func (v ValueDescriptor) Validate() (bool, error)
Validate satisfies the Validator interface
Source Files ¶
- action.go
- actiontype.go
- addressable.go
- adminstate.go
- autoevent.go
- callbackalert.go
- category.go
- channel.go
- channel_type.go
- command.go
- commandresponse.go
- describedobject.go
- device.go
- deviceprofile.go
- devicereport.go
- deviceresource.go
- deviceservice.go
- encryptiondetails.go
- errors.go
- event.go
- filter.go
- get.go
- interval.go
- interval_action.go
- log_entry.go
- notifications.go
- notify_update.go
- operatingstate.go
- profileproperty.go
- profileresource.go
- propertyvalue.go
- provisionwatcher.go
- put.go
- reading.go
- registration.go
- resourceoperation.go
- response.go
- severity.go
- sma_operation.go
- status.go
- subscription.go
- timestamps.go
- transmission.go
- transmission_record.go
- transmission_status.go
- units.go
- validator.go
- value-descriptor.go