appcontext

package
v1.9.10 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppFunction

type AppFunction = func(edgexcontext *Context, params ...interface{}) (bool, interface{})

AppFunction is a type alias for func(edgexcontext *appcontext.Context, params ...interface{}) (bool, interface{})

type Context

type Context struct {
	// ID of the EdgeX Event -- will be filled for a received JSON Event
	EventID string
	// Checksum of the EdgeX Event -- will be filled for a received CBOR Event
	EventChecksum string
	// This is the ID used to track the EdgeX event through entire EdgeX framework.
	CorrelationID string
	// OutputData is used for specifying the data that is to be outputted. Leverage the .Complete() function to set.
	OutputData []byte
	// This holds the configuration for your service. This is the preferred way to access your custom application settings that have been set in the configuration.
	Configuration *common.ConfigurationStruct
	// LoggingClient is exposed to allow logging following the preferred logging strategy within EdgeX.
	LoggingClient logger.LoggingClient
	// EventClient exposes Core Data's EventClient API
	EventClient coredata.EventClient
	// ValueDescriptorClient exposes Core Data's ValueDescriptor API
	ValueDescriptorClient coredata.ValueDescriptorClient
	// CommandClient exposes Core Commands's Command API
	CommandClient command.CommandClient
	// NotificationsClient exposes Support Notification's Notifications API
	NotificationsClient notifications.NotificationsClient
	// RetryData holds the data to be stored for later retry when the pipeline function returns an error
	RetryData []byte
	// SecretProvider exposes the support for getting and storing secrets
	SecretProvider security.SecretProvider
}

Context ...

func (*Context) Complete

func (context *Context) Complete(output []byte)

Complete is optional and provides a way to return the specified data. In the case of an HTTP Trigger, the data will be returned as the http response. In the case of the message bus trigger, the data will be placed on the specifed message bus publish topic and host in the configuration.

func (*Context) GetSecrets

func (context *Context) GetSecrets(path string, keys ...string) (map[string]string, error)

GetSecrets retrieves secrets from a secret store. path specifies the type or location of the secrets to retrieve. keys specifies the secrets which to retrieve. If no keys are provided then all the keys associated with the specified path will be returned.

func (*Context) MarkAsPushed

func (context *Context) MarkAsPushed() error

MarkAsPushed will make a request to CoreData to mark the event that triggered the pipeline as pushed.

func (*Context) PushToCoreData

func (context *Context) PushToCoreData(deviceName string, readingName string, value interface{}) (*models.Event, error)

PushToCoreData 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.

func (*Context) SetRetryData

func (context *Context) SetRetryData(payload []byte)

SetRetryData sets the RetryData to the specified payload to be stored for later retry when the pipeline function returns an error.

Jump to

Keyboard shortcuts

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