Documentation ¶
Index ¶
- type Context
- func (appContext *Context) AddValue(key string, value string)
- func (appContext *Context) ApplyValues(format string) (string, error)
- func (appContext *Context) ClearRetryTriggerFlag()
- func (appContext *Context) Clone() interfaces.AppFunctionContext
- func (appContext *Context) CommandClient() clients.CommandClient
- func (appContext *Context) CorrelationID() string
- func (appContext *Context) DeviceClient() clients.DeviceClient
- func (appContext *Context) DeviceProfileClient() clients.DeviceProfileClient
- func (appContext *Context) DeviceServiceClient() clients.DeviceServiceClient
- func (appContext *Context) EventClient() clients.EventClient
- func (appContext *Context) GetAllValues() map[string]string
- func (appContext *Context) GetDeviceResource(profileName string, resourceName string) (dtos.DeviceResource, error)
- func (appContext *Context) GetValue(key string) (string, bool)
- func (appContext *Context) InputContentType() string
- func (appContext *Context) IsRetryTriggered() bool
- func (appContext *Context) LoggingClient() logger.LoggingClient
- func (appContext *Context) MetricsManager() bootstrapInterfaces.MetricsManager
- func (appContext *Context) NotificationClient() clients.NotificationClient
- func (appContext *Context) PipelineId() string
- func (appContext *Context) Publish(data any, contentType string) error
- func (appContext *Context) PublishWithTopic(topic string, data any, contentType string) error
- func (appContext *Context) ReadingClient() clients.ReadingClient
- func (appContext *Context) RemoveValue(key string)
- func (appContext *Context) ResponseContentType() string
- func (appContext *Context) ResponseData() []byte
- func (appContext *Context) RetryData() []byte
- func (appContext *Context) SecretProvider() bootstrapInterfaces.SecretProvider
- func (appContext *Context) SetCorrelationID(id string)
- func (appContext *Context) SetInputContentType(contentType string)
- func (appContext *Context) SetResponseContentType(contentType string)
- func (appContext *Context) SetResponseData(output []byte)
- func (appContext *Context) SetRetryData(payload []byte)
- func (appContext *Context) SubscriptionClient() clients.SubscriptionClient
- func (appContext *Context) TriggerRetryFailedData()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { // Dic is public, so we can confirm it is set correctly Dic *di.Container // contains filtered or unexported fields }
Context contains the data functions that implement the interfaces.AppFunctionContext
func NewContext ¶
NewContext creates, initializes and return a new Context with implements the interfaces.AppFunctionContext interface
func (*Context) ApplyValues ¶
ApplyValues looks in the provided string for placeholders of the form '{any-value-key}' and attempts to replace with the value stored under the key in context storage. An error will be returned if any placeholders are not matched to a value in the context.
func (*Context) ClearRetryTriggerFlag ¶
func (appContext *Context) ClearRetryTriggerFlag()
ClearRetryTriggerFlag clears the flag to trigger retry of failed data. This function is not part of the AppFunctionContext interface, so it is internal SDK use only
func (*Context) Clone ¶
func (appContext *Context) Clone() interfaces.AppFunctionContext
Clone returns a copy of the context that can be manipulated independently.
func (*Context) CommandClient ¶
func (appContext *Context) CommandClient() clients.CommandClient
CommandClient returns the Command client, which may be nil, from the dependency injection container
func (*Context) CorrelationID ¶
CorrelationID returns context's the correlation ID
func (*Context) DeviceClient ¶
func (appContext *Context) DeviceClient() clients.DeviceClient
DeviceClient returns the Device client, which may be nil, from the dependency injection container
func (*Context) DeviceProfileClient ¶
func (appContext *Context) DeviceProfileClient() clients.DeviceProfileClient
DeviceProfileClient returns the DeviceProfile client, which may be nil, from the dependency injection container
func (*Context) DeviceServiceClient ¶
func (appContext *Context) DeviceServiceClient() clients.DeviceServiceClient
DeviceServiceClient returns the DeviceService client, which may be nil, from the dependency injection container
func (*Context) EventClient ¶
func (appContext *Context) EventClient() clients.EventClient
EventClient returns the Event client, which may be nil, from the dependency injection container
func (*Context) GetAllValues ¶
GetAllValues returns a read-only copy of all data stored in the context
func (*Context) GetDeviceResource ¶
func (appContext *Context) GetDeviceResource(profileName string, resourceName string) (dtos.DeviceResource, error)
GetDeviceResource retrieves the DeviceResource for given profileName and resourceName.
func (*Context) GetValue ¶
GetValue attempts to retrieve a value stored in the context at the given key
func (*Context) InputContentType ¶
InputContentType returns the context's inputContentType
func (*Context) IsRetryTriggered ¶
IsRetryTriggered gets the flag to trigger retry of failed data. This function is not part of the AppFunctionContext interface, so it is internal SDK use only
func (*Context) LoggingClient ¶
func (appContext *Context) LoggingClient() logger.LoggingClient
LoggingClient returns the Logging client from the dependency injection container
func (*Context) MetricsManager ¶
func (appContext *Context) MetricsManager() bootstrapInterfaces.MetricsManager
MetricsManager returns the Metrics Manager used to register counter, gauge, gaugeFloat64 or timer metric types from github.com/rcrowley/go-metrics
func (*Context) NotificationClient ¶
func (appContext *Context) NotificationClient() clients.NotificationClient
NotificationClient returns the Notification client, which may be nil, from the dependency injection container
func (*Context) PipelineId ¶
PipelineId returns the ID of the pipeline that is executing
func (*Context) PublishWithTopic ¶
PublishWithTopic pushes data to the MessageBus for a given topic
func (*Context) ReadingClient ¶
func (appContext *Context) ReadingClient() clients.ReadingClient
ReadingClient returns the Reading client, which may be nil, from the dependency injection container
func (*Context) RemoveValue ¶
RemoveValue deletes a value stored in the context at the given key
func (*Context) ResponseContentType ¶
ResponseContentType returns the context's responseContentType
func (*Context) ResponseData ¶
ResponseData returns the context's responseData.
func (*Context) RetryData ¶
RetryData returns the context's retryData. This function is not part of the AppFunctionContext interface, so it is internal SDK use only
func (*Context) SecretProvider ¶
func (appContext *Context) SecretProvider() bootstrapInterfaces.SecretProvider
SecretProvider returns the SecretProvider instance
func (*Context) SetCorrelationID ¶
SetCorrelationID sets the correlationID. This function is not part of the AppFunctionContext interface, so it is internal SDK use only
func (*Context) SetInputContentType ¶
SetInputContentType sets the inputContentType. This function is not part of the AppFunctionContext interface, so it is internal SDK use only
func (*Context) SetResponseContentType ¶
SetResponseContentType sets the context's responseContentType
func (*Context) SetResponseData ¶
SetResponseData provides a way to return the specified data as a response to the trigger that initiated the execution of the function pipeline. In the case of an HTTP Trigger, the data will be returned as the http response. In the case of a message bus trigger, the data will be published to the configured message bus publish topic.
func (*Context) SetRetryData ¶
SetRetryData sets the context's retryData to the specified payload to be stored for later retry when the pipeline function returns an error.
func (*Context) SubscriptionClient ¶
func (appContext *Context) SubscriptionClient() clients.SubscriptionClient
SubscriptionClient returns the Subscription client, which may be nil, from the dependency injection container
func (*Context) TriggerRetryFailedData ¶
func (appContext *Context) TriggerRetryFailedData()
TriggerRetryFailedData sets the flag to trigger retry of failed data.