appsdk

package
v0.2.0-dev.6 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 30 Imported by: 23

Documentation

Index

Constants

View Source
const (
	ValueDescriptors = "valuedescriptors"
	DeviceNames      = "devicenames"
	Key              = "key"
	InitVector       = "initvector"
	Url              = "url"
	MimeType         = "mimetype"
	Cert             = "cert"
	Qos              = "qos"
	Retain           = "retain"
	AutoReconnect    = "autoreconnect"
)
View Source
const ProfileSuffixPlaceholder = "<profile>"

ProfileSuffixPlaceholder is used to create unique names for profiles

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

func (sdk *AppFunctionsSDK) AESTransform(encryptionDetails models.EncryptionDetails) func(*appcontext.Context, ...interface{}) (bool, interface{})

AESTransform encrypts either a string, []byte, or json.Marshaller type using AES encryption. It will return a byte[] of the encrypted data. This function is a configuration function and returns a function pointer.

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) appcontext.AppFunction

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

func (sdk *AppFunctionsSDK) GZIPTransform() func(*appcontext.Context, ...interface{}) (bool, interface{})

GZIPTransform compresses data received as either a string,[]byte, or json.Marshaler using gzip algorithm and returns a base64 encoded string as a []byte. This function is a configuration function and returns a function pointer.

func (*AppFunctionsSDK) HTTPPost

func (sdk *AppFunctionsSDK) HTTPPost(url string, mimeType string) appcontext.AppFunction

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) appcontext.AppFunction

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) appcontext.AppFunction

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, initialize the logging system, and ingest configuration.

func (*AppFunctionsSDK) JSONTransform

func (sdk *AppFunctionsSDK) JSONTransform() appcontext.AppFunction

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) LoadConfigurablePipeline added in v1.0.0

func (sdk *AppFunctionsSDK) LoadConfigurablePipeline() ([]appcontext.AppFunction, error)

LoadConfigurablePipeline ...

func (*AppFunctionsSDK) MQTTSend

func (sdk *AppFunctionsSDK) MQTTSend(addr models.Addressable, cert string, key string, qos byte, retain bool, autoreconnect bool) appcontext.AppFunction

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 ...appcontext.AppFunction) 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) SetOutputData

func (sdk *AppFunctionsSDK) SetOutputData() appcontext.AppFunction

SetOutputData sets the output data to that passed in from the previous function. It will return an error and stop the pipeline if data passed in is not of type []byte, string or json.Mashaler This function is a configuration function and returns a function pointer.

func (*AppFunctionsSDK) ValueDescriptorFilter

func (sdk *AppFunctionsSDK) ValueDescriptorFilter(valueDescriptors []string) appcontext.AppFunction

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() appcontext.AppFunction

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.

func (*AppFunctionsSDK) ZLIBTransform

func (sdk *AppFunctionsSDK) ZLIBTransform() func(*appcontext.Context, ...interface{}) (bool, interface{})

ZLIBTransform compresses data received as either a string,[]byte, or json.Marshaler using zlib algorithm and returns a base64 encoded string as a []byte. This function is a configuration function and returns a function pointer.

type AppFunctionsSDKConfigurable added in v1.0.0

type AppFunctionsSDKConfigurable struct {
	Sdk *AppFunctionsSDK
}

AppFunctionsSDKConfigurable contains the helper functions that return the function pointers for building the configurable function pipeline. They transform the parameters map from the Pipeline configuration in to the actual actual parameters required by the function.

func (AppFunctionsSDKConfigurable) AESTransform

func (dynamic AppFunctionsSDKConfigurable) AESTransform(parameters map[string]string) appcontext.AppFunction

AESTransform encrypts either a string, []byte, or json.Marshaller type using AES encryption. It will return a byte[] of the encrypted data. This function is a configuration function and returns a function pointer.

func (AppFunctionsSDKConfigurable) DeviceNameFilter

func (dynamic AppFunctionsSDKConfigurable) DeviceNameFilter(parameters map[string]string) appcontext.AppFunction

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 (AppFunctionsSDKConfigurable) GZIPTransform

func (dynamic AppFunctionsSDKConfigurable) GZIPTransform() appcontext.AppFunction

GZIPTransform compresses data received as either a string,[]byte, or json.Marshaler using gzip algorithm and returns a base64 encoded string as a []byte. This function is a configuration function and returns a function pointer.

func (AppFunctionsSDKConfigurable) HTTPPost added in v1.0.0

func (dynamic AppFunctionsSDKConfigurable) HTTPPost(parameters map[string]string) appcontext.AppFunction

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 (AppFunctionsSDKConfigurable) HTTPPostJSON added in v1.0.0

func (dynamic AppFunctionsSDKConfigurable) HTTPPostJSON(parameters map[string]string) appcontext.AppFunction

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 (AppFunctionsSDKConfigurable) HTTPPostXML added in v1.0.0

func (dynamic AppFunctionsSDKConfigurable) HTTPPostXML(parameters map[string]string) appcontext.AppFunction

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 (AppFunctionsSDKConfigurable) JSONTransform

func (dynamic AppFunctionsSDKConfigurable) JSONTransform() appcontext.AppFunction

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 (AppFunctionsSDKConfigurable) MQTTSend added in v1.0.0

func (dynamic AppFunctionsSDKConfigurable) MQTTSend(parameters map[string]string, addr models.Addressable) appcontext.AppFunction

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 (AppFunctionsSDKConfigurable) SetOutputData added in v1.0.0

func (dynamic AppFunctionsSDKConfigurable) SetOutputData() appcontext.AppFunction

SetOutputData sets the output data to that passed in from the previous function. It will return an error and stop the pipeline if data passed in is not of type []byte, string or json.Mashaler This function is a configuration function and returns a function pointer.

func (AppFunctionsSDKConfigurable) ValueDescriptorFilter

func (dynamic AppFunctionsSDKConfigurable) ValueDescriptorFilter(parameters map[string]string) appcontext.AppFunction

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 (AppFunctionsSDKConfigurable) XMLTransform

func (dynamic AppFunctionsSDKConfigurable) XMLTransform() appcontext.AppFunction

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.

func (AppFunctionsSDKConfigurable) ZLIBTransform

func (dynamic AppFunctionsSDKConfigurable) ZLIBTransform() appcontext.AppFunction

ZLIBTransform compresses data received as either a string,[]byte, or json.Marshaler using zlib algorithm and returns a base64 encoded string as a []byte. This function is a configuration function and returns a function pointer.

Jump to

Keyboard shortcuts

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