models

package
v0.0.0-...-9f3e423 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

******************************************************************************

  • Copyright 2018 Dell Technologies Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. * ******************************************************************************

******************************************************************************

  • Copyright 2017 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

Index

Constants

View Source
const (
	PROFILE          ActionType = "PROFILE"
	DEVICE                      = "DEVICE"
	SERVICE                     = "SERVICE"
	SCHEDULE                    = "SCHEDULE"
	SCHEDULEEVENT               = "SCHEDULEEVENT"
	ADDRESSABLE                 = "ADDRESSABLE"
	VALUEDESCRIPTOR             = "VALUEDESCRIPTOR"
	PROVISIONWATCHER            = "PROVISIONWATCHER"
	REPORT                      = "REPORT"
)
View Source
const (
	// Locked : device is locked
	// Unlocked : device is unlocked
	Locked   = "LOCKED"
	Unlocked = "UNLOCKED"
)
View Source
const (
	Security = "SECURITY"
	Hwhealth = "HW_HEALTH"
	Swhealth = "SW_HEALTH"
)
View Source
const (
	Rest  = "REST"
	Email = "EMAIL"
)
View Source
const (
	Enabled  = "ENABLED"
	Disabled = "DISABLED"
)

Enabled : ENABLED Disabled : DISABLED

View Source
const (
	Critical = "CRITICAL"
	Normal   = "NORMAL"
)
View Source
const (
	New       = "NEW"
	Processed = "PROCESSED"
	Escalated = "ESCALATED"
)
View Source
const (
	Failed       = "FAILED"
	Sent         = "SENT"
	Acknowledged = "ACKNOWLEDGED"
	Trxescalated = "TRXESCALATED"
)

Variables

This section is empty.

Functions

func IsAdminStateType

func IsAdminStateType(as string) bool

func IsChannelType

func IsChannelType(as string) bool

func IsNotificationsCategory

func IsNotificationsCategory(as string) bool

func IsNotificationsSeverity

func IsNotificationsSeverity(as string) bool

func IsNotificationsStatus

func IsNotificationsStatus(as string) bool

func IsOperatingStateType

func IsOperatingStateType(os string) bool

IsOperatingStateType : return if ostype

func IsTransmissionStatus

func IsTransmissionStatus(as string) bool

Types

type Action

type Action struct {
	Path      string     `bson:"path" json:"path"`           // path used by service for action on a device or sensor
	Responses []Response `bson:"responses" json:"responses"` // responses from get or put requests to service
	URL       string     `json:"url,omitempty"`              // url for requests from command service
}

func (Action) String

func (a Action) String() string

* String() function for formatting

type ActionType

type ActionType string

type Addressable

type Addressable struct {
	BaseObject `bson:",inline"`
	Id         bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Name       string        `bson:"name" json:"name"`
	Protocol   string        `bson:"protocol" json:"protocol"`   // Protocol for the address (HTTP/TCP)
	HTTPMethod string        `bson:"method" json:"method"`       // Method for connecting (i.e. POST)
	Address    string        `bson:"address" json:"address"`     // Address of the addressable
	Port       int           `bson:"port" json:"port,Number"`    // Port for the address
	Path       string        `bson:"path" json:"path"`           // Path for callbacks
	Publisher  string        `bson:"publisher" json:"publisher"` // For message bus protocols
	User       string        `bson:"user" json:"user"`           // User id for authentication
	Password   string        `bson:"password" json:"password"`   // Password of the user for authentication for the addressable
	Topic      string        `bson:"topic" json:"topic"`         // Topic for message bus addressables
}

* This file is the model for addressable in EdgeX * Addressable holds information about a specific address * * Addressable struct

func (Addressable) GetBaseURL

func (a Addressable) GetBaseURL() string

func (Addressable) GetCallbackURL

func (a Addressable) GetCallbackURL() string

Get the callback url for the addressable if all relevant tokens have values. If any token is missing, string will be empty

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) String

func (a Addressable) String() string

* String() function for formatting

type AdminState

type AdminState string

AdminState : unlocked or locked

func GetAdminState

func GetAdminState(as string) (AdminState, bool)

func (*AdminState) UnmarshalJSON

func (as *AdminState) UnmarshalJSON(data []byte) error

* Unmarshal the enum type

type BaseObject

type BaseObject struct {
	Created  int64 `bson:"created" json:"created"`
	Modified int64 `bson:"modified" json:"modified"`
	Origin   int64 `bson:"origin" json:"origin"`
}

func (*BaseObject) String

func (o *BaseObject) String() string

* String function for representing a device

type CallbackAlert

type CallbackAlert struct {
	ActionType ActionType `json:"type"`
	Id         string     `json:"id"`
}

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

type Channel

type Channel struct {
	Type          ChannelType `bson:"type,omitempty" json:"type,omitempty"`
	MailAddresses []string    `bson:"mailAddresses,omitempty" json:"mailAddresses,omitempty"`
	Url           string      `bson:"url,omitempty" json:"url,omitempty"`
}

TODO - this is ugly and I want to someday have two different structs of EMailChannel and RESTChannel

func (Channel) String

func (c Channel) String() string

type ChannelType

type ChannelType string

func (*ChannelType) UnmarshalJSON

func (as *ChannelType) UnmarshalJSON(data []byte) error

type Command

type Command struct {
	BaseObject `bson:",inline" yaml:",inline"`
	Id         bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Name       string        `bson:"name" json:"name" yaml:"name"` // Command name (unique on the profile)
	Get        *Get          `bson:"get" json:"get" yaml:"get"`    // Get Command
	Put        *Put          `bson:"put" json:"put" yaml:"put"`    // Put Command
}

* This file is the model for a command in EdgeX * * * Command struct

func (*Command) AllAssociatedValueDescriptors

func (c *Command) AllAssociatedValueDescriptors(vdNames *map[string]string)

Append all the associated value descriptors to the list Associated by PUT command parameters and PUT/GET command return values

func (Command) MarshalJSON

func (c Command) MarshalJSON() ([]byte, error)

Custom marshaling for making empty strings null

func (Command) String

func (c Command) String() string

* String() function for formatting

func (*Command) UnmarshalJSON

func (c *Command) UnmarshalJSON(b []byte) error

type CommandResponse

type CommandResponse struct {
	Id             bson.ObjectId  `json:"id"`
	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
}

* This file is the model for the CommandResponse object in EdgeX * * * CommandResponse struct

func CommandResponseFromDevice

func CommandResponseFromDevice(d Device, cmdURL string) CommandResponse

* Create a Command Response struct from a Device Struct

func (CommandResponse) MarshalJSON

func (cr CommandResponse) MarshalJSON() ([]byte, error)

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 {
	BaseObject  `bson:",inline" yaml:",inline"`
	Description string `bson:"description" json:"description" yaml:"description"`
}

func (DescribedObject) String

func (o DescribedObject) String() string

* String function for DescribedObject

type Device

type Device struct {
	DescribedObject `bson:",inline"`
	Id              bson.ObjectId  `bson:"_id,omitempty" json:"id"`
	Name            string         `bson:"name" json:"name"`                     // Unique name for identifying a device
	AdminState      AdminState     `bson:"adminState" json:"adminState"`         // Admin state (locked/unlocked)
	OperatingState  OperatingState `bson:"operatingState" json:"operatingState"` // Operating state (enabled/disabled)
	Addressable     Addressable    `bson:"addressable" json:"addressable"`       // Addressable for the device - stores information about it's address
	LastConnected   int64          `bson:"lastConnected" json:"lastConnected"`   // Time (milliseconds) that the device last provided any feedback or responded to any request
	LastReported    int64          `bson:"lastReported" json:"lastReported"`     // Time (milliseconds) that the device reported data to the core microservice
	Labels          []string       `bson:"labels" json:"labels"`                 // Other labels applied to the device to help with searching
	Location        interface{}    `bson:"location" json:"location"`             // Device service specific location (interface{} is an empty interface so it can be anything)
	Service         DeviceService  `bson:"service" json:"service"`               // Associated Device Service - One per device
	Profile         DeviceProfile  `bson:"profile" json:"profile"`               // Associated Device Profile - Describes the device
}

* This file is the model for the Device object in EdgeX * * * Device struct

func (*Device) AllAssociatedValueDescriptors

func (d *Device) AllAssociatedValueDescriptors(vdNames *[]string)

Return all the associated value descriptors through Put command parameters and Put/Get command return values

func (Device) MarshalJSON

func (d Device) MarshalJSON() ([]byte, error)

Custom marshaling to make empty strings null

func (Device) String

func (d Device) String() string

* String function for representing a device

type DeviceObject

type DeviceObject struct {
	//	DescribedObject				`bson:",inline" yaml:",inline"`
	//	Id		bson.ObjectId		`bson:"_id,omitempty" json:"id"`
	Description string `bson:"description" json:"description"`
	Name        string `bson:"name" json:"name"`
	Tag         string `bson:"tag" json:"tag"`
	//	Properties 	ProfileProperty 	`bson:"profileProperty" json:"profileProperty"`
	Properties ProfileProperty        `bson:"properties" json:"properties" yaml:"properties"`
	Attributes map[string]interface{} `bson:"attributes" json:"attributes" yaml:"attributes"`
}

func (DeviceObject) MarshalJSON

func (do DeviceObject) MarshalJSON() ([]byte, error)

Custom marshaling to make empty strings null

func (DeviceObject) String

func (do DeviceObject) String() string

* To String function for DeviceObject

type DeviceProfile

type DeviceProfile struct {
	DescribedObject `bson:",inline" yaml:",inline"`
	Id              bson.ObjectId     `bson:"_id,omitempty" json:"id"`
	Name            string            `bson:"name" json:"name" yaml:"name"`                         // Non-database identifier (must be unique)
	Manufacturer    string            `bson:"manufacturer" json:"manufacturer" yaml:"manufacturer"` // Manufacturer of the device
	Model           string            `bson:"model" json:"model" yaml:"model"`                      // Model of the device
	Labels          []string          `bson:"labels" json:"labels" yaml:"labels,flow"`              // Labels used to search for groups of profiles
	Objects         interface{}       `bson:"objects" json:"objects" yaml:"objects"`                // JSON data that the device service uses to communicate with devices with this profile
	DeviceResources []DeviceObject    `bson:"deviceResources" json:"deviceResources" yaml:"deviceResources"`
	Resources       []ProfileResource `bson:"resources" json:"resources" yaml:"resources"`
	Commands        []Command         `bson:"commands" json:"commands" yaml:"commands"` // List of commands to Get/Put information for devices associated with this profile
}

*This file is the model for a device profile in EdgeX * * * Device profile struct

func (DeviceProfile) MarshalJSON

func (dp DeviceProfile) MarshalJSON() ([]byte, error)

Custom marshaling so that empty strings and arrays are null

func (DeviceProfile) String

func (dp DeviceProfile) String() string

* To String function for DeviceProfile

type DeviceReport

type DeviceReport struct {
	BaseObject `bson:",inline"`
	Id         bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Name       string        `bson:"name" json:"name"`         // non-database identifier for a device report - must be unique
	Device     string        `bson:"device" json:"device"`     // associated device name - should be a valid and unique device name
	Event      string        `bson:"event" json:"event"`       // associated schedule event name - should be a valid and unique schedule event name
	Expected   []string      `bson:"expected" json:"expected"` // array of value descriptor names describing the types of data captured in the report
}

func (DeviceReport) MarshalJSON

func (dp 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 DeviceService

type DeviceService struct {
	Service
	AdminState AdminState `bson:"adminState" json:"adminState"` // Device Service Admin State
}

func (DeviceService) MarshalJSON

func (ds DeviceService) MarshalJSON() ([]byte, error)

Custom Marshaling 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

Custom unmarshaling funcion

type Event

type Event struct {
	ID       bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Pushed   int64         `bson:"pushed" json:"pushed"`
	Device   string        `bson:"device" json:"device"` // Device identifier (name or id)
	Created  int64         `bson:"created" json:"created"`
	Modified int64         `bson:"modified" json:"modified"`
	Origin   int64         `bson:"origin" json:"origin"`
	Event    string        `bson:"event,omitempty" json:"event"` // Schedule event identifier
	Readings []Reading     `bson:"readings" json:"readings"`     // List of readings
}

* This file is for the Event model in EdgeX * * * Event struct to hold event data

func (Event) MarshalJSON

func (e Event) MarshalJSON() ([]byte, error)

Custom marshaling to make empty strings null

func (Event) String

func (e Event) String() string

type Get

type Get struct {
	Action `bson:",inline" yaml:",inline"`
}

func (*Get) AllAssociatedValueDescriptors

func (g *Get) AllAssociatedValueDescriptors(vdNames *map[string]string)

Append the associated value descriptors to the list

func (Get) MarshalJSON

func (g Get) MarshalJSON() ([]byte, error)

Custom marshaling to make empty strings and arrays null

func (Get) String

func (g Get) String() string

* To String function for Get Struct

type LogEntry

type LogEntry struct {
	Level         string   `json:"logLevel"`
	Labels        []string `json:"labels"`
	OriginService string   `json:"originService"`
	Message       string   `json:"message"`
	Created       int64    `json:"created"`
}

func (LogEntry) MarshalJSON

func (l LogEntry) MarshalJSON() ([]byte, error)

type Notification

type Notification struct {
	BaseObject  `bson:",inline"`
	ID          bson.ObjectId         `json:"id" bson:"_id,omitempty"`
	Slug        string                `bson:"slug" json:"slug,omitempty"`
	Sender      string                `bson:"sender" json:"sender,omitempty"`
	Category    NotificationsCategory `bson:"category" json:"category,omitempty"`
	Severity    NotificationsSeverity `bson:"severity" json:"severity,omitempty"`
	Content     string                `bson:"content" json:"content,omitempty"`
	Description string                `bson:"description" json:"description,omitempty"`
	Status      NotificationsStatus   `bson:"status" json:"status,omitempty"`
	Labels      []string              `bson:"labels,omitempty" json:"labels,omitempty"`
	ContentType string                `bson:"contenttype" json:"contenttype,omitempty"`
}

func (Notification) MarshalJSON

func (n Notification) MarshalJSON() ([]byte, error)

func (Notification) String

func (n Notification) String() string

* To String function for Notification Struct

type NotificationsCategory

type NotificationsCategory string

func (*NotificationsCategory) UnmarshalJSON

func (as *NotificationsCategory) UnmarshalJSON(data []byte) error

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"`
}

type OperatingState

type OperatingState string

OperatingState Constant String

func GetOperatingState

func GetOperatingState(os string) (OperatingState, bool)

func (*OperatingState) UnmarshalJSON

func (os *OperatingState) UnmarshalJSON(data []byte) error

UnmarshalJSON : Struct into json

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) String

func (o Operation) String() string

* To String function for Operation struct

func (*Operation) UnmarshalJSON

func (o *Operation) UnmarshalJSON(data []byte) error

Implements unmarshaling of JSON string to Operation type instance

type ProfileProperty

type ProfileProperty struct {
	Value PropertyValue `bson:"value" json:"value"`
	Units Units         `bson:"units" json:"units"`
}

func (ProfileProperty) String

func (pp ProfileProperty) String() string

* To String function for DeviceService

type ProfileResource

type ProfileResource struct {
	Name string              `bson:"name" json:"name"`
	Get  []ResourceOperation `bson:"get" json:"get"`
	Set  []ResourceOperation `bson:"set" json:"set"`
}

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 `bson:"type" json:"type"`                                     // ValueDescriptor Type of property after transformations
	ReadWrite    string `bson:"readWrite" json:"readWrite" yaml:"readWrite"`          // Read/Write Permissions set for this property
	Minimum      string `bson:"minimum" json:"minimum"`                               // Minimum value that can be get/set from this property
	Maximum      string `bson:"maximum" json:"maximum"`                               // Maximum value that can be get/set from this property
	DefaultValue string `bson:"defaultValue" json:"defaultValue" yaml:"defaultValue"` // Default value set to this property if no argument is passed
	Size         string `bson:"size" json:"size"`                                     // Size of this property in its type  (i.e. bytes for numeric types, characters for string types)
	Word         string `bson:"word" json:"word"`                                     // Word size of property used for endianness
	LSB          string `bson:"lsb" json:"lsb"`                                       // Endianness setting for a property
	Mask         string `bson:"mask" json:"mask"`                                     // Mask to be applied prior to get/set of property
	Shift        string `bson:"shift" json:"shift"`                                   // Shift to be applied after masking, prior to get/set of property
	Scale        string `bson:"scale" json:"scale"`                                   // Multiplicative factor to be applied after shifting, prior to get/set of property
	Offset       string `bson:"offset" json:"offset"`                                 // Additive factor to be applied after multiplying, prior to get/set of property
	Base         string `bson:"base" json:"base"`                                     // Base for property to be applied to, leave 0 for no power operation (i.e. base ^ property: 2 ^ 10)
	Assertion    string `bson:"assertion" json:"assertion"`                           // Required value of the property, set for checking error state.  Failing an assertion condition will mark the device with an error state
	Signed       bool   `bson:"signed" json:"signed"`                                 // Treat the property as a signed or unsigned value
	Precision    string `bson:"precision" json:"precision"`
}

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

func (*PropertyValue) UnmarshalJSON

func (p *PropertyValue) UnmarshalJSON(data []byte) error

Custom unmarshaling to handle default values

func (*PropertyValue) UnmarshalYAML

func (p *PropertyValue) UnmarshalYAML(unmarshal func(interface{}) error) error

Custom YAML unmarshaling

type ProvisionWatcher

type ProvisionWatcher struct {
	BaseObject     `bson:",inline"`
	Id             bson.ObjectId     `bson:"_id,omitempty" json:"id"`
	Name           string            `bson:"name" json:"name"`                     // unique name and identifier of the addressable
	Identifiers    map[string]string `bson:"identifiers" json:"identifiers"`       // set of key value pairs that identify type of of address (MAC, HTTP,...) and address to watch for (00-05-1B-A1-99-99, 10.0.0.1,...)
	Profile        DeviceProfile     `bson:"profile" json:"profile"`               // device profile that should be applied to the devices available at the identifier addresses
	Service        DeviceService     `bson:"service" json:"service"`               // device service that owns the watcher
	OperatingState OperatingState    `bson:"operatingState" json:"operatingState"` // operational state - either enabled or disabled
}

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

type Put

type Put struct {
	Action         `bson:",inline" yaml:",inline"`
	ParameterNames []string `bson:"parameterNames" json:"parameterNames" yaml:"parameterNames"`
}

* This file is the model for Put commands in EdgeX * * Put Struct

func (*Put) AllAssociatedValueDescriptors

func (p *Put) AllAssociatedValueDescriptors(vdNames *map[string]string)

Append the associated value descriptors to the list

func (Put) MarshalJSON

func (p Put) MarshalJSON() ([]byte, error)

Custom marshaling to make empty strings null

func (Put) String

func (p Put) String() string

* To String function for Put struct

type Reading

type Reading struct {
	Id       bson.ObjectId `bson:"_id,omitempty"`
	Pushed   int64         `bson:"pushed" json:"pushed"`   // When the data was pushed out of EdgeX (0 - not pushed yet)
	Created  int64         `bson:"created" json:"created"` // When the reading was created
	Origin   int64         `bson:"origin" json:"origin"`
	Modified int64         `bson:"modified" json:"modified"`
	Device   string        `bson:"device" json:"device"`
	Name     string        `bson:"name" json:"name"`
	Value    string        `bson:"value" json:"value"` // Device sensor data value
}

* This file is for the Reading model in EdgeX * Holds data that was gathered from a device * * * Struct for the Reading object in EdgeX

func (Reading) MarshalJSON

func (r Reading) MarshalJSON() ([]byte, error)

Custom marshaling to make empty strings null

func (Reading) String

func (r Reading) String() string

* To String function for Reading Struct

type ResourceOperation

type ResourceOperation struct {
	Index     string            `bson:"index" json:"index"`
	Operation string            `bson:"operation" json:"operation"`
	Object    string            `bson:"object" json:"object"`
	Property  string            `bson:"property" json:"property"`
	Parameter string            `bson:"parameter" json:"parameter"`
	Resource  string            `bson:"resource" json:"resource"`
	Secondary []string          `bson:"secondary" json:"secondary"`
	Mappings  map[string]string `bson:"mappings" json:"mappings"`
}

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

type Response

type Response struct {
	Code           string   `bson:"code" json:"code" yaml:"code"`
	Description    string   `bson:"description" json:"description" yaml:"description"`
	ExpectedValues []string `bson:"expectedValues" json:"expectedValues" yaml:"expectedValues"`
}

* Response for a Get or Put request to a service * * * Response Struct

func (Response) Equals

func (r Response) Equals(r2 Response) bool

func (Response) MarshalJSON

func (r Response) MarshalJSON() ([]byte, error)

Custom marshalling to make empty strings null

func (Response) String

func (a Response) String() string

* To String function for Response Struct

type Schedule

type Schedule struct {
	BaseObject `bson:",inline"`
	Id         bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Name       string        `bson:"name" json:"name"`           // non-database identifier for a shcedule (*must be quitue)
	Start      string        `bson:"start" json:"start"`         // Start time in ISO 8601 format YYYYMMDD'T'HHmmss 	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyymmdd'T'HHmmss")
	End        string        `bson:"end" json:"end"`             // Start time in ISO 8601 format YYYYMMDD'T'HHmmss 	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyymmdd'T'HHmmss")
	Frequency  string        `bson:"frequency" json:"frequency"` // how frequently should the event occur
	Cron       string        `bson:"cron" json:"cron"`           // cron styled regular expression indicating how often the action under schedule should occur.  Use either runOnce, frequency or cron and not all.
	RunOnce    bool          `bson:"runOnce" json:"runOnce"`     // boolean indicating that this schedules runs one time - at the time indicated by the start
}

func (Schedule) MarshalJSON

func (s Schedule) MarshalJSON() ([]byte, error)

Custom marshaling to make empty strings null

func (Schedule) String

func (dp Schedule) String() string

* To String function for Schedule

type ScheduleEvent

type ScheduleEvent struct {
	BaseObject  `bson:",inline"`
	Id          bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Name        string        `bson:"name" json:"name"`               // non-database unique identifier for a schedule event
	Schedule    string        `bson:"schedule" json:"schedule"`       // Name to associated owning schedule
	Addressable Addressable   `bson:"addressable" json:"addressable"` // address {MQTT topic, HTTP address, serial bus, etc.} for the action (can be empty)
	Parameters  string        `bson:"parameters" json:"parameters"`   // json body for parameters
	Service     string        `bson:"service" json:"service"`         // json body for parameters
}

func (ScheduleEvent) MarshalJSON

func (se ScheduleEvent) MarshalJSON() ([]byte, error)

Custom marshaling to make empty strings null

func (ScheduleEvent) String

func (se ScheduleEvent) String() string

* To String function for ScheduleEvent

type Service

type Service struct {
	DescribedObject `bson:",inline"`
	Id              bson.ObjectId  `bson:"_id,omitempty" json:"id"`
	Name            string         `bson:"name" json:"name"`                     // time in milliseconds that the device last provided any feedback or responded to any request
	LastConnected   int64          `bson:"lastConnected" json:"lastConnected"`   // time in milliseconds that the device last reported data to the core
	LastReported    int64          `bson:"lastReported" json:"lastReported"`     // operational state - either enabled or disabled
	OperatingState  OperatingState `bson:"operatingState" json:"operatingState"` // operational state - ether enabled or disableddc
	Labels          []string       `bson:"labels" json:"labels"`                 // tags or other labels applied to the device service for search or other identification needs
	Addressable     Addressable    `bson:"addressable" json:"addressable"`       // address (MQTT topic, HTTP address, serial bus, etc.) for reaching the service
}

func (Service) MarshalJSON

func (s Service) MarshalJSON() ([]byte, error)

Custom Marshaling to make empty strings null

func (Service) String

func (dp Service) String() string

* To String function for Service

type Subscription

type Subscription struct {
	BaseObject           `bson:",inline"`
	ID                   bson.ObjectId           `bson:"_id,omitempty" json:"id"`
	Slug                 string                  `bson:"slug" json:"slug,omitempty"`
	Receiver             string                  `bson:"receiver" json:"receiver,omitempty"`
	Description          string                  `bson:"description" json:"description,omitempty"`
	SubscribedCategories []NotificationsCategory `bson:"subscribedCategories,omitempty" json:"subscribedCategories,omitempty"`
	SubscribedLabels     []string                `bson:"subscribedLabels,omitempty" json:"subscribedLabels,omitempty"`
	Channels             []Channel               `bson:"channels,omitempty" 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 Transmission

type Transmission struct {
	BaseObject   `bson:",inline"`
	ID           bson.ObjectId        `json:"id" bson:"_id,omitempty"`
	Notification Notification         `json:"notification" bson:"notification,omitempty"`
	Receiver     string               `bson:"receiver" json:"receiver,omitempty"`
	Channel      Channel              `bson:"channel,omitempty" json:"channel,omitempty"`
	Status       TransmissionStatus   `bson:"status" json:"status,omitempty"`
	ResendCount  int                  `bson:"resendcount" json:"resendcount"`
	Records      []TransmissionRecord `bson:"records,omitempty" json:"records,omitempty"`
}

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

type TransmissionRecord

type TransmissionRecord struct {
	Status   TransmissionStatus `bson:"status" json:"status"`
	Response string             `bson:"response" json:"response"`
	Sent     int64              `bson:"sent" 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

type Units

type Units struct {
	Type         string `bson:"type" json:"type"`
	ReadWrite    string `bson:"readWrite" json:"readWrite" yaml:"readWrite"`
	DefaultValue string `bson:"defaultValue" json:"defaultValue" yaml:"defaultValue"`
}

func (Units) MarshalJSON

func (u Units) MarshalJSON() ([]byte, error)

Custom marshaling to make empty strings null

func (Units) String

func (u Units) String() string

* To String function for Units

type ValueDescriptor

type ValueDescriptor struct {
	Id           bson.ObjectId `json:"id" bson:"_id,omitempty"`
	Created      int64         `bson:"created" json:"created"`
	Description  string        `bson:"description" json:"description"`
	Modified     int64         `bson:"modified" json:"modified"`
	Origin       int64         `bson:"origin" json:"origin"`
	Name         string        `bson:"name" json:"name"`
	Min          interface{}   `bson:"min,omitempty" json:"min"`
	Max          interface{}   `bson:"max,omitempty" json:"max"`
	DefaultValue interface{}   `bson:"defaultValue,omitempty" json:"defaultValue"`
	Type         string        `bson:"type" json:"type"`
	UomLabel     string        `bson:"uomLabel,omitempty" json:"uomLabel"`
	Formatting   string        `bson:"formatting,omitempty" json:"formatting"`
	Labels       []string      `bson:"labels,omitempty" json:"labels"`
}

* Value Descriptor Struct

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

Jump to

Keyboard shortcuts

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