faas

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(f NitricFunction) error

Start - Starts accepting requests for the provided NitricFunction Begins streaming using the default Nitric FaaS gRPC client This should be the only method called in the 'main' method of your entrypoint package

func StartWithClient added in v0.3.0

func StartWithClient(f NitricFunction, faasClient pb.FaasClient) error

Types

type HttpResponseContext added in v0.3.0

type HttpResponseContext struct {
	Headers map[string]string
	Status  int
}

type NitricFunction

type NitricFunction func(*NitricTrigger) (*NitricResponse, error)

NitricFunction - a function built using Nitric, to be executed

type NitricHttpTriggerContext added in v0.3.0

type NitricHttpTriggerContext struct {
	Method      string
	Headers     map[string]string
	Path        string
	QueryParams map[string]string
}

type NitricResponse

type NitricResponse struct {
	// contains filtered or unexported fields
}

NitricResponse - represents the results of calling a function.

func (*NitricResponse) GetContext added in v0.3.0

func (n *NitricResponse) GetContext() *ResponseContext

func (*NitricResponse) SetData added in v0.3.0

func (n *NitricResponse) SetData(data []byte)

func (*NitricResponse) ToTriggerResponse added in v0.3.0

func (n *NitricResponse) ToTriggerResponse() *pb.TriggerResponse

ToTriggerResponse - Tranlates a Nitric Response for gRPC transport to the membrane

type NitricTopicTriggerContext added in v0.3.0

type NitricTopicTriggerContext struct {
	Topic string
}

type NitricTrigger added in v0.3.0

type NitricTrigger struct {
	// contains filtered or unexported fields
}

NitricRequest - represents a request to trigger a function, with payload and context required to execute that function.

func FromGrpcTriggerRequest added in v0.3.0

func FromGrpcTriggerRequest(triggerReq *pb.TriggerRequest) (*NitricTrigger, error)

FromGrpcTriggerRequest - converts a standard nitric TriggerRequest request into a Trigger to be passed to functions.

func (*NitricTrigger) DefaultResponse added in v0.3.0

func (n *NitricTrigger) DefaultResponse() *NitricResponse

DefaultResponse - Returns a default response object dependent on the Trigger context

func (*NitricTrigger) GetContext added in v0.3.0

func (n *NitricTrigger) GetContext() *NitricTriggerContext

GetContext - return the context of a request, with metadata about that request.

func (*NitricTrigger) GetData added in v0.3.0

func (n *NitricTrigger) GetData() []byte

GetData - return the []byte data of the request.

func (*NitricTrigger) GetDataAsStruct added in v0.3.0

func (n *NitricTrigger) GetDataAsStruct(object interface{}) error

GetDataAsStruct - Unmarshals the request body from JSON to the provided interface{}

func (*NitricTrigger) GetMimeType added in v0.3.0

func (n *NitricTrigger) GetMimeType() string

GetMimeType - return the mime-type of the data for this trigger

type NitricTriggerContext added in v0.3.0

type NitricTriggerContext struct {
	// contains filtered or unexported fields
}

NitricTriggerContext - Represents the contextual metadata for a Nitric function request.

func ContextFromTriggerRequest added in v0.3.0

func ContextFromTriggerRequest(grpcTrigger *pb.TriggerRequest) *NitricTriggerContext

ContextFromTriggerRequest - Creates TriggerContext from grpc TriggerRequest

func (*NitricTriggerContext) AsHttp added in v0.3.0

AsHttp - Returns NitricTriggerContext as NitricHttpTriggerContext if IsHttp is true otherwise returns nil

func (*NitricTriggerContext) AsTopic added in v0.3.0

AsTopic - Returns NitricTriggerContext as NitricTopicTriggerContext if IsTopic is true otherwise returns nil

func (*NitricTriggerContext) IsHttp added in v0.3.0

func (c *NitricTriggerContext) IsHttp() bool

IsHttp - Returns true if the trigger was via an HTTP Request and HTTP metadata is available

func (*NitricTriggerContext) IsTopic added in v0.3.0

func (c *NitricTriggerContext) IsTopic() bool

IsTopic - Returns true if the trigger was an Event via a Topic and Event/Topic metadata is available

type ResponseContext added in v0.3.0

type ResponseContext struct {
	// contains filtered or unexported fields
}

ResponseContext

func (*ResponseContext) AsHttp added in v0.3.0

func (c *ResponseContext) AsHttp() *HttpResponseContext

func (*ResponseContext) AsTopic added in v0.3.0

func (c *ResponseContext) AsTopic() *TopicResponseContext

func (*ResponseContext) IsHttp added in v0.3.0

func (c *ResponseContext) IsHttp() bool

func (*ResponseContext) IsTopic added in v0.3.0

func (c *ResponseContext) IsTopic() bool

type TopicResponseContext added in v0.3.0

type TopicResponseContext struct {
	Success bool
}

Jump to

Keyboard shortcuts

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