Documentation
¶
Index ¶
- type AppFunctionsSDK
- func (sdk *AppFunctionsSDK) ApplicationSettings() map[string]string
- func (sdk *AppFunctionsSDK) DeviceNameFilter(deviceNames []string) func(*appcontext.Context, ...interface{}) (bool, interface{})
- func (sdk *AppFunctionsSDK) HTTPPost(url string, mimeType string) func(*appcontext.Context, ...interface{}) (bool, interface{})
- func (sdk *AppFunctionsSDK) HTTPPostJSON(url string) func(*appcontext.Context, ...interface{}) (bool, interface{})
- func (sdk *AppFunctionsSDK) HTTPPostXML(url string) func(*appcontext.Context, ...interface{}) (bool, interface{})
- func (sdk *AppFunctionsSDK) Initialize() error
- func (sdk *AppFunctionsSDK) JSONTransform() func(*appcontext.Context, ...interface{}) (bool, interface{})
- func (sdk *AppFunctionsSDK) MQTTSend(addr models.Addressable, cert string, key string, qos byte, retain bool, ...) func(*appcontext.Context, ...interface{}) (bool, interface{})
- func (sdk *AppFunctionsSDK) MakeItRun() error
- func (sdk *AppFunctionsSDK) SetFunctionsPipeline(...) error
- func (sdk *AppFunctionsSDK) ValueDescriptorFilter(valueIDs []string) func(*appcontext.Context, ...interface{}) (bool, interface{})
- func (sdk *AppFunctionsSDK) XMLTransform() func(*appcontext.Context, ...interface{}) (bool, interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppFunctionsSDK ¶
type AppFunctionsSDK struct {
ServiceKey string
LoggingClient logger.LoggingClient
// contains filtered or unexported fields
}
AppFunctionsSDK provides the necessary struct to create an instance of the Application Functions SDK. Be sure and provide a ServiceKey when creating an instance of the SDK. After creating an instance, you'll first want to call .Initialize(), to start up the SDK. Secondly, provide the desired transforms for your pipeline by calling .SetFunctionsPipeline(). Lastly, call .MakeItRun() to start listening for events based on your configured trigger.
func (*AppFunctionsSDK) ApplicationSettings ¶
func (sdk *AppFunctionsSDK) ApplicationSettings() map[string]string
ApplicationSettings returns the values specifed in the custom configuration section.
func (*AppFunctionsSDK) DeviceNameFilter ¶
func (sdk *AppFunctionsSDK) DeviceNameFilter(deviceNames []string) func(*appcontext.Context, ...interface{}) (bool, interface{})
DeviceNameFilter - Specify the devices of interest to filter for data coming from certain sensors. The Filter by Device transform looks at the Event in the message and looks at the devices of interest list, provided by this function, and filters out those messages whose Event is for devices not on the devices of interest. This function will return an error and stop the pipeline if a non-edgex event is received or if no data is recieved. For example, data generated by a motor does not get passed to functions only interested in data from a thermostat. This function is a configuration function and returns a function pointer.
func (*AppFunctionsSDK) HTTPPost ¶
func (sdk *AppFunctionsSDK) HTTPPost(url string, mimeType string) func(*appcontext.Context, ...interface{}) (bool, interface{})
HTTPPost will send data from the previous function to the specified Endpoint via http POST. If no previous function exists, then the event that triggered the pipeline will be used. Passing an empty string to the mimetype method will default to application/json. This function is a configuration function and returns a function pointer.
func (*AppFunctionsSDK) HTTPPostJSON ¶
func (sdk *AppFunctionsSDK) HTTPPostJSON(url string) func(*appcontext.Context, ...interface{}) (bool, interface{})
HTTPPostJSON sends data from the previous function to the specified Endpoint via http POST with a mime type of application/json. If no previous function exists, then the event that triggered the pipeline will be used. This function is a configuration function and returns a function pointer.
func (*AppFunctionsSDK) HTTPPostXML ¶
func (sdk *AppFunctionsSDK) HTTPPostXML(url string) func(*appcontext.Context, ...interface{}) (bool, interface{})
HTTPPostXML sends data from the previous function to the specified Endpoint via http POST with a mime type of application/xml. If no previous function exists, then the event that triggered the pipeline will be used. This function is a configuration function and returns a function pointer.
func (*AppFunctionsSDK) Initialize ¶
func (sdk *AppFunctionsSDK) Initialize() error
Initialize will parse command line flags, register for interrupts, initalize the logging system, and ingest configuration.
func (*AppFunctionsSDK) JSONTransform ¶
func (sdk *AppFunctionsSDK) JSONTransform() func(*appcontext.Context, ...interface{}) (bool, interface{})
JSONTransform transforms an EdgeX event to JSON. It will return an error and stop the pipeline if a non-edgex event is received or if no data is recieved. This function is a configuration function and returns a function pointer.
func (*AppFunctionsSDK) MQTTSend ¶
func (sdk *AppFunctionsSDK) MQTTSend(addr models.Addressable, cert string, key string, qos byte, retain bool, autoreconnect bool) func(*appcontext.Context, ...interface{}) (bool, interface{})
MQTTSend sends data from the previous function to the specified MQTT broker. If no previous function exists, then the event that triggered the pipeline will be used. This function is a configuration function and returns a function pointer.
func (*AppFunctionsSDK) MakeItRun ¶
func (sdk *AppFunctionsSDK) MakeItRun() error
MakeItRun will initialize and start the trigger as specifed in the configuration. It will also configure the webserver and start listening on the specified port.
func (*AppFunctionsSDK) SetFunctionsPipeline ¶
func (sdk *AppFunctionsSDK) SetFunctionsPipeline(transforms ...func(edgexcontext *appcontext.Context, params ...interface{}) (bool, interface{})) error
SetFunctionsPipeline allows you to define each function to execute and the order in which each function will be called as each event comes in.
func (*AppFunctionsSDK) ValueDescriptorFilter ¶
func (sdk *AppFunctionsSDK) ValueDescriptorFilter(valueIDs []string) func(*appcontext.Context, ...interface{}) (bool, interface{})
ValueDescriptorFilter - Specify the value descriptors of interest to filter for data from certain types of IoT objects, such as temperatures, motion, and so forth, that may come from an array of sensors or devices. The Filter by Value Descriptor assesses the data in each Event and Reading, and removes readings that have a value descriptor that is not in the list of value descriptors of interest for the application. This function will return an error and stop the pipeline if a non-edgex event is received or if no data is recieved. For example, pressure reading data does not go to functions only interested in motion data. This function is a configuration function and returns a function pointer.
func (*AppFunctionsSDK) XMLTransform ¶
func (sdk *AppFunctionsSDK) XMLTransform() func(*appcontext.Context, ...interface{}) (bool, interface{})
XMLTransform transforms an EdgeX event to XML. It will return an error and stop the pipeline if a non-edgex event is received or if no data is recieved. This function is a configuration function and returns a function pointer.