Documentation ¶
Index ¶
- Constants
- type ConfigUpdateProcessor
- type Configurable
- func (app *Configurable) AddTags(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) Batch(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) Compress(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) Encrypt(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) FilterByDeviceName(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) FilterByProfileName(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) FilterByResourceName(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) FilterBySourceName(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) HTTPExport(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) JSONLogic(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) MQTTExport(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) PushToCore(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) SetResponseData(parameters map[string]string) interfaces.AppFunction
- func (app *Configurable) Transform(parameters map[string]string) interfaces.AppFunction
- type Service
- func (svc *Service) AddBackgroundPublisher(capacity int) interfaces.BackgroundPublisher
- func (svc *Service) AddRoute(route string, handler func(nethttp.ResponseWriter, *nethttp.Request), ...) error
- func (svc *Service) ApplicationSettings() map[string]string
- func (svc *Service) CommandClient() command.CommandClient
- func (svc *Service) EventClient() coredata.EventClient
- func (svc *Service) GetAppSetting(setting string) (string, error)
- func (svc *Service) GetAppSettingStrings(setting string) ([]string, error)
- func (svc *Service) GetSecret(path string, keys ...string) (map[string]string, error)
- func (svc *Service) Initialize() error
- func (svc *Service) ListenForCustomConfigChanges(configToWatch interface{}, sectionName string, ...) error
- func (svc *Service) LoadConfigurablePipeline() ([]interfaces.AppFunction, error)
- func (svc *Service) LoadCustomConfig(customConfig interfaces.UpdatableConfig, sectionName string) error
- func (svc *Service) LoggingClient() logger.LoggingClient
- func (svc *Service) MakeItRun() error
- func (svc *Service) MakeItStop()
- func (svc *Service) NotificationsClient() notifications.NotificationsClient
- func (svc *Service) RegisterCustomTriggerFactory(name string, ...) error
- func (svc *Service) RegistryClient() registry.Client
- func (svc *Service) SetFunctionsPipeline(transforms ...interfaces.AppFunction) error
- func (svc *Service) StoreSecret(path string, secretData map[string]string) error
Constants ¶
const ( ProfileNames = "profilenames" DeviceNames = "devicenames" SourceNames = "sourcenames" ResourceNames = "resourcenames" FilterOut = "filterout" EncryptionKey = "key" InitVector = "initvector" Url = "url" ExportMethod = "method" ExportMethodPost = "post" ExportMethodPut = "put" MimeType = "mimetype" PersistOnError = "persistonerror" SkipVerify = "skipverify" Qos = "qos" Retain = "retain" AutoReconnect = "autoreconnect" DeviceName = "devicename" ReadingName = "readingname" Rule = "rule" BatchThreshold = "batchthreshold" TimeInterval = "timeinterval" HeaderName = "headername" SecretPath = "secretpath" SecretName = "secretname" BrokerAddress = "brokeraddress" ClientID = "clientid" Topic = "topic" TransformType = "type" TransformXml = "xml" TransformJson = "json" AuthMode = "authmode" Tags = "tags" ResponseContentType = "responsecontenttype" Algorithm = "algorithm" CompressGZIP = "gzip" CompressZLIB = "zlib" EncryptAES = "aes" Mode = "mode" BatchByCount = "bycount" BatchByTime = "bytime" BatchByTimeAndCount = "bytimecount" )
const ( // Valid types of App Service triggers TriggerTypeMessageBus = "EDGEX-MESSAGEBUS" TriggerTypeMQTT = "EXTERNAL-MQTT" TriggerTypeHTTP = "HTTP" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigUpdateProcessor ¶
type ConfigUpdateProcessor struct {
// contains filtered or unexported fields
}
ConfigUpdateProcessor contains the data need to process configuration updates
func NewConfigUpdateProcessor ¶
func NewConfigUpdateProcessor(svc *Service) *ConfigUpdateProcessor
NewConfigUpdateProcessor creates a new ConfigUpdateProcessor which processes configuration updates triggered from the Configuration Provider
func (*ConfigUpdateProcessor) WaitForConfigUpdates ¶
func (processor *ConfigUpdateProcessor) WaitForConfigUpdates(configUpdated config.UpdatedStream)
WaitForConfigUpdates waits for signal that configuration has been updated (triggered from by Configuration Provider) and then determines what was updated and does any special processing, if needed, for the updates.
type Configurable ¶
type Configurable struct {
// contains filtered or unexported fields
}
Configurable 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 NewConfigurable ¶
func NewConfigurable(lc logger.LoggingClient) *Configurable
NewConfigurable returns a new instance of Configurable
func (*Configurable) AddTags ¶
func (app *Configurable) AddTags(parameters map[string]string) interfaces.AppFunction
AddTags adds the configured list of tags to Events passed to the transform. This function is a configuration function and returns a function pointer.
func (*Configurable) Batch ¶
func (app *Configurable) Batch(parameters map[string]string) interfaces.AppFunction
Batch sets up Batching of events based on the specified mode parameter (BatchByCount, BatchByTime or BatchByTimeAndCount) and mode specific parameters. This function is a configuration function and returns a function pointer.
func (*Configurable) Compress ¶
func (app *Configurable) Compress(parameters map[string]string) interfaces.AppFunction
Compress compresses data received as either a string,[]byte, or json.Marshaller using the specified algorithm (GZIP or ZLIB) and returns a base64 encoded string as a []byte. This function is a configuration function and returns a function pointer.
func (*Configurable) Encrypt ¶
func (app *Configurable) Encrypt(parameters map[string]string) interfaces.AppFunction
Encrypt encrypts either a string, []byte, or json.Marshaller type using specified encryption algorithm (AES only at this time). It will return a byte[] of the encrypted data. This function is a configuration function and returns a function pointer.
func (*Configurable) FilterByDeviceName ¶
func (app *Configurable) FilterByDeviceName(parameters map[string]string) interfaces.AppFunction
FilterByDeviceName - Specify the device names of interest to filter for data coming from certain sensors. The Filter by Device Name transform looks at the Event in the message and looks at the device names of interest list, provided by this function, and filters out those messages whose Event is for device names not in the device names of interest. This function will return an error and stop the pipeline if a non-edgex event is received or if no data is received. 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 (*Configurable) FilterByProfileName ¶
func (app *Configurable) FilterByProfileName(parameters map[string]string) interfaces.AppFunction
FilterByProfileName - Specify the profile names of interest to filter for data coming from certain sensors. The Filter by Profile Name transform looks at the Event in the message and looks at the profile names of interest list, provided by this function, and filters out those messages whose Event is for profile names not in the profile names of interest. This function will return an error and stop the pipeline if a non-edgex event is received or if no data is received. 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 (*Configurable) FilterByResourceName ¶
func (app *Configurable) FilterByResourceName(parameters map[string]string) interfaces.AppFunction
FilterByResourceName - Specify the resource name 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 resource name assesses the data in each Event and Reading, and removes readings that have a resource name that is not in the list of resource names 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 received. 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 (*Configurable) FilterBySourceName ¶
func (app *Configurable) FilterBySourceName(parameters map[string]string) interfaces.AppFunction
FilterBySourceName - Specify the source names (resources and/or commands) of interest to filter for data coming from certain sensors. The Filter by Source Name transform looks at the Event in the message and looks at the source names of interest list, provided by this function, and filters out those messages whose Event is for source names not in the source names of interest. This function will return an error and stop the pipeline if a non-edgex event is received or if no data is received. 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 (*Configurable) HTTPExport ¶
func (app *Configurable) HTTPExport(parameters map[string]string) interfaces.AppFunction
HTTPExport will send data from the previous function to the specified Endpoint via http POST or PUT. 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 (*Configurable) JSONLogic ¶
func (app *Configurable) JSONLogic(parameters map[string]string) interfaces.AppFunction
JSONLogic ...
func (*Configurable) MQTTExport ¶
func (app *Configurable) MQTTExport(parameters map[string]string) interfaces.AppFunction
MQTTExport will send data from the previous function to the specified Endpoint via MQTT publish. 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 (*Configurable) PushToCore ¶
func (app *Configurable) PushToCore(parameters map[string]string) interfaces.AppFunction
PushToCore pushes the provided value as an event to CoreData using the device name and reading name that have been set. If validation is turned on in CoreServices then your deviceName and readingName must exist in the CoreMetadata and be properly registered in EdgeX. This function is a configuration function and returns a function pointer.
func (*Configurable) SetResponseData ¶
func (app *Configurable) SetResponseData(parameters map[string]string) interfaces.AppFunction
SetResponseData sets the response data to that passed in from the previous function and the response content type to that set in the ResponseContentType configuration parameter. It will return an error and stop the pipeline if data passed in is not of type []byte, string or json.Marshaller This function is a configuration function and returns a function pointer.
func (*Configurable) Transform ¶
func (app *Configurable) Transform(parameters map[string]string) interfaces.AppFunction
Transform transforms an EdgeX event to XML or JSON based on specified transform type. It will return an error and stop the pipeline if a non-edgex event is received or if no data is received. This function is a configuration function and returns a function pointer.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides the necessary struct and functions to create an instance of the interfaces.ApplicationService interface.
func NewService ¶
func NewService(serviceKey string, targetType interface{}, profileSuffixPlaceholder string) *Service
NewService create, initializes and returns new instance of app.Service which implements the interfaces.ApplicationService interface
func (*Service) AddBackgroundPublisher ¶
func (svc *Service) AddBackgroundPublisher(capacity int) interfaces.BackgroundPublisher
AddBackgroundPublisher will create a channel of provided capacity to be consumed by the MessageBus output and return a publisher that writes to it
func (*Service) AddRoute ¶
func (svc *Service) AddRoute(route string, handler func(nethttp.ResponseWriter, *nethttp.Request), methods ...string) error
AddRoute allows you to leverage the existing webserver to add routes.
func (*Service) ApplicationSettings ¶
ApplicationSettings returns the values specified in the custom configuration section.
func (*Service) CommandClient ¶
func (svc *Service) CommandClient() command.CommandClient
CommandClient returns the Command client, which may be nil, from the dependency injection container
func (*Service) EventClient ¶
func (svc *Service) EventClient() coredata.EventClient
EventClient returns the Event client, which may be nil, from the dependency injection container
func (*Service) GetAppSetting ¶
GetAppSettingStrings returns the string for the specified App Setting.
func (*Service) GetAppSettingStrings ¶
GetAppSettingStrings returns the strings slice for the specified App Setting.
func (*Service) GetSecret ¶
GetSecret retrieves secret data from the secret store at the specified path.
func (*Service) Initialize ¶
Initialize bootstraps the service making it ready to accept functions for the pipeline and to run the configured trigger.
func (*Service) ListenForCustomConfigChanges ¶
func (svc *Service) ListenForCustomConfigChanges(configToWatch interface{}, sectionName string, changedCallback func(interface{})) error
ListenForCustomConfigChanges uses the Config Processor from go-mod-bootstrap to attempt to listen for changes to the specified custom configuration section. LoadCustomConfig must be called previously so that the instance of svc.configProcessor has already been set.
func (*Service) LoadConfigurablePipeline ¶
func (svc *Service) LoadConfigurablePipeline() ([]interfaces.AppFunction, error)
LoadConfigurablePipeline sets the function pipeline from configuration
func (*Service) LoadCustomConfig ¶
func (svc *Service) LoadCustomConfig(customConfig interfaces.UpdatableConfig, sectionName string) error
LoadCustomConfig uses the Config Processor from go-mod-bootstrap to attempt to load service's custom configuration. It uses the same command line flags to process the custom config in the same manner as the standard configuration.
func (*Service) LoggingClient ¶
func (svc *Service) LoggingClient() logger.LoggingClient
LoggingClient returns the Logging client from the dependency injection container
func (*Service) MakeItRun ¶
MakeItRun initializes and starts the trigger as specified in the configuration. It will also configure the webserver and start listening on the specified port.
func (*Service) MakeItStop ¶
func (svc *Service) MakeItStop()
MakeItStop will force the service loop to exit in the same fashion as SIGINT/SIGTERM received from the OS
func (*Service) NotificationsClient ¶
func (svc *Service) NotificationsClient() notifications.NotificationsClient
NotificationsClient returns the Notifications client, which may be nil, from the dependency injection container
func (*Service) RegisterCustomTriggerFactory ¶
func (svc *Service) RegisterCustomTriggerFactory(name string, factory func(interfaces.TriggerConfig) (interfaces.Trigger, error)) error
RegisterCustomTriggerFactory allows users to register builders for custom trigger types
func (*Service) RegistryClient ¶
RegistryClient returns the Registry client, which may be nil, from the dependency injection container
func (*Service) SetFunctionsPipeline ¶
func (svc *Service) SetFunctionsPipeline(transforms ...interfaces.AppFunction) error
SetFunctionsPipeline sets the function pipeline to the list of specified functions in the order provided.