appfunction

package
v2.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 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 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) CommandClient

func (appContext *Context) CommandClient() interfaces.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() interfaces.DeviceClient

DeviceClient returns the Device client, which may be nil, from the dependency injection container

func (*Context) DeviceProfileClient

func (appContext *Context) DeviceProfileClient() interfaces.DeviceProfileClient

DeviceProfileClient returns the DeviceProfile client, which may be nil, from the dependency injection container

func (*Context) DeviceServiceClient

func (appContext *Context) DeviceServiceClient() interfaces.DeviceServiceClient

DeviceServiceClient returns the DeviceService client, which may be nil, from the dependency injection container

func (*Context) EventClient

func (appContext *Context) EventClient() interfaces.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) GetSecret

func (appContext *Context) GetSecret(path string, keys ...string) (map[string]string, error)

GetSecret returns the secret data from the secret store (secure or insecure) for the specified path.

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

func (appContext *Context) LoggingClient() logger.LoggingClient

LoggingClient returns the Logging client from the dependency injection container

func (*Context) NotificationClient

func (appContext *Context) NotificationClient() interfaces.NotificationClient

NotificationClient returns the Notification client, which may be nil, from the dependency injection container

func (*Context) PushToCore

func (appContext *Context) PushToCore(event dtos.Event) (common.BaseWithIdResponse, error)

PushToCore pushes a new event to Core Data.

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

func (appContext *Context) SecretsLastUpdated() time.Time

SecretsLastUpdated returns that timestamp for when the secrets in the SecretStore where last updated.

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() interfaces.SubscriptionClient

SubscriptionClient returns the Subscription client, which may be nil, from the dependency injection container

Jump to

Keyboard shortcuts

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