lambda

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package aws contains the services for AWS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleBase64

func HandleBase64(src []byte) []byte

HandleBase64 tries to decode the provided byte slice.

Types

type Body

type Body struct {
	Data      []byte `json:"-" yaml:"-"`
	Formatted bool   `json:"-" yaml:"-"`
}

func (*Body) MarshalJSON

func (b *Body) MarshalJSON() ([]byte, error)

func (*Body) String

func (b *Body) String() string

func (*Body) UnmarshalJSON

func (b *Body) UnmarshalJSON(bytes []byte) error

func (*Body) UnmarshalYAML

func (b *Body) UnmarshalYAML(value *yaml.Node) error

type Facade

type Facade interface {
	// Invoke the lambda from the provided arn.ARN using the provided Request.
	Invoke(ctx context.Context, ref FnRef, request *Request) (*Response, error)
	// CanInvoke checks, if the lambda function can be invoked. Returns an error if this is not the case.
	CanInvoke(ctx context.Context, ref FnRef) error
}

Facade for invocation.

func NewLambdaService

func NewLambdaService(ctx context.Context, userCfg *usercfg.AWS) (Facade, error)

NewLambdaService from aws-sdk.

type FnRef

type FnRef struct {
	// Name of the function
	Name string
	// RoleARN to be assumed (optional)
	RoleARN *arn.ARN
}

FnRef provides the necessary parameters for invoking a lambda function.

type Headers

type Headers http.Header

func (*Headers) MarshalJSON

func (h *Headers) MarshalJSON() ([]byte, error)

func (*Headers) UnmarshalJSON

func (h *Headers) UnmarshalJSON(data []byte) error

func (*Headers) UnmarshalYAML

func (h *Headers) UnmarshalYAML(value *yaml.Node) error

type Request

type Request struct {
	// Host in the request.
	Host string `json:"host,omitempty" yaml:"host,omitempty"`
	// URI (complete) from the request.
	URI string `json:"uri,omitempty" yaml:"uri,omitempty"`
	// Headers of the request.
	Headers Headers `json:"headers,omitempty" yaml:"header,omitempty"`
	// Method from the request.
	Method string `json:"method,omitempty" yaml:"method,omitempty"`
	// Vars parsed from the path.
	Vars map[string]string `json:"vars,omitempty" yaml:"vars,omitempty"`
	// Body from the request
	Body []byte `json:"body,omitempty" yaml:"body,omitempty"`
}

Request to be sent to the lambda.

type Response

type Response struct {
	// StatusCode for the http response.
	StatusCode int `json:"statusCode" yaml:"statusCode"`
	// Headers to be appended.
	Headers Headers `json:"headers" yaml:"headers"`
	// Body to be written.
	Body Body `json:"body" yaml:"body"`
}

Response from the invocation.

type SdkFacade

type SdkFacade struct {
	Clients sdk.AssumeClients[sdk.Lambda]
}

func (*SdkFacade) CanInvoke

func (s *SdkFacade) CanInvoke(ctx context.Context, ref FnRef) error

func (*SdkFacade) Invoke

func (s *SdkFacade) Invoke(ctx context.Context, ref FnRef, req *Request) (*Response, error)

Jump to

Keyboard shortcuts

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