lambda

package
v1.1.0-beta.17 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelperModule

func HelperModule(extraOptions fx.Option) fx.Option

HelperModule returns fx module for initialization of helper to start HTTP client for handlers.

The module is only loaded once.

Types

type Event

type Event struct {
	ID         string    `json:"id"`
	Source     string    `json:"source"`
	Region     string    `json:"region"`
	DetailType string    `json:"detail-type"`
	Time       time.Time `json:"time"`
	Account    string    `json:"account"`
	Resources  []string  `json:"resources"`
	Records    []Record  `json:"Records"`
}

type Handler

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

Handler can be used to process events.

func NewHandler

func NewHandler(handler *cloudevents.HandlerWrapper, options *Options) *Handler

NewHandler creates a new handler wrapped in middleware.

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, event Event) error

Handle processes an event by calling the necessary middlewares.

type Helper

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

Helper assists in creating event handlers.

func NewDefaultHelper

func NewDefaultHelper(handler *cloudevents.HandlerWrapper) *Helper

NewHelper returns a new Helper with default options.

func NewHelper

func NewHelper(handler *cloudevents.HandlerWrapper, options *Options) *Helper

NewHelper returns a new Helper with options.

func (*Helper) Start

func (h *Helper) Start()

Start starts HTTP client for handle events.

type Options

type Options struct {
	Skip bool
}

Options can be used to create customized handler.

func DefaultOptions

func DefaultOptions() (*Options, error)

DefaultOptions returns options based in config.

type Record

type Record struct {
	EventVersion           string                                `json:"eventVersion"`
	EventSubscriptionArn   string                                `json:"eventSubscriptionArn"`
	EventSource            string                                `json:"eventSource"`
	EventName              string                                `json:"eventName"`
	EventID                string                                `json:"eventID"`
	SNS                    events.SNSEntity                      `json:"sns"`
	S3                     events.S3Entity                       `json:"s3"`
	Kinesis                events.KinesisRecord                  `json:"kinesis"`
	DynamoDB               events.DynamoDBStreamRecord           `json:"dynamodb"`
	MessageId              string                                `json:"messageId"`
	ReceiptHandle          string                                `json:"receiptHandle"`
	Body                   string                                `json:"body"`
	Md5OfBody              string                                `json:"md5OfBody"`
	Md5OfMessageAttributes string                                `json:"md5OfMessageAttributes"`
	Attributes             map[string]string                     `json:"attributes"`
	MessageAttributes      map[string]events.SQSMessageAttribute `json:"messageAttributes"`
	EventSourceARN         string                                `json:"eventSourceARN"`
	AWSRegion              string                                `json:"awsRegion"`
	UserIdentity           interface{}                           `json:"userIdentity"`
}

Jump to

Keyboard shortcuts

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