appfunction

package
v3.2.0-dev.43 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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

func NewContext(correlationID string, dic *di.Container, inputContentType string) *Context

NewContext creates, initializes and return a new Context with implements the interfaces.AppFunctionContext interface

func (*Context) AddValue

func (appContext *Context) AddValue(key string, value string)

AddValue stores a value for access within other functions in pipeline

func (*Context) ApplyValues

func (appContext *Context) ApplyValues(format string) (string, error)

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

func (appContext *Context) CorrelationID() string

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

func (appContext *Context) GetAllValues() map[string]string

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

func (appContext *Context) GetValue(key string) (string, bool)

GetValue attempts to retrieve a value stored in the context at the given key

func (*Context) InputContentType

func (appContext *Context) InputContentType() string

InputContentType returns the context's inputContentType

func (*Context) IsRetryTriggered

func (appContext *Context) IsRetryTriggered() bool

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

func (appContext *Context) PipelineId() string

PipelineId returns the ID of the pipeline that is executing

func (*Context) Publish added in v3.1.0

func (appContext *Context) Publish(data any, contentType string) error

Publish pushes data to the MessageBus using configured topic

func (*Context) PublishWithTopic added in v3.1.0

func (appContext *Context) PublishWithTopic(topic string, data any, contentType string) error

PublishWithTopic pushes data to the MessageBus for a given topic

func (*Context) ReadingClient added in v3.1.0

func (appContext *Context) ReadingClient() clients.ReadingClient

ReadingClient returns the Reading client, which may be nil, from the dependency injection container

func (*Context) RemoveValue

func (appContext *Context) RemoveValue(key string)

RemoveValue deletes a value stored in the context at the given key

func (*Context) ResponseContentType

func (appContext *Context) ResponseContentType() string

ResponseContentType returns the context's responseContentType

func (*Context) ResponseData

func (appContext *Context) ResponseData() []byte

ResponseData returns the context's responseData.

func (*Context) RetryData

func (appContext *Context) RetryData() []byte

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

func (appContext *Context) SetCorrelationID(id string)

SetCorrelationID sets the correlationID. This function is not part of the AppFunctionContext interface, so it is internal SDK use only

func (*Context) SetInputContentType

func (appContext *Context) SetInputContentType(contentType string)

SetInputContentType sets the inputContentType. This function is not part of the AppFunctionContext interface, so it is internal SDK use only

func (*Context) SetResponseContentType

func (appContext *Context) SetResponseContentType(contentType string)

SetResponseContentType sets the context's responseContentType

func (*Context) SetResponseData

func (appContext *Context) SetResponseData(output []byte)

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

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

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.

Jump to

Keyboard shortcuts

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