actions

package
v0.0.0-...-d62be3e Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalculatorParameters

type CalculatorParameters struct {
	Action string `json:"action"`
	X      int    `json:"x"`
	Y      int    `json:"y"`
}

CalculatorParameters is used to serialize parameters to the calculator Lambda handler.

type FunctionWrapper

type FunctionWrapper struct {
	LambdaClient *lambda.Client
}

FunctionWrapper encapsulates function actions used in the examples. It contains an AWS Lambda service client that is used to perform user actions.

func (FunctionWrapper) CreateFunction

func (wrapper FunctionWrapper) CreateFunction(ctx context.Context, functionName string, handlerName string,
	iamRoleArn *string, zipPackage *bytes.Buffer) types.State

CreateFunction creates a new Lambda function from code contained in the zipPackage buffer. The specified handlerName must match the name of the file and function contained in the uploaded code. The role specified by iamRoleArn is assumed by Lambda and grants specific permissions. When the function already exists, types.StateActive is returned. When the function is created, a lambda.FunctionActiveV2Waiter is used to wait until the function is active.

func (FunctionWrapper) DeleteFunction

func (wrapper FunctionWrapper) DeleteFunction(ctx context.Context, functionName string)

DeleteFunction deletes the Lambda function specified by functionName.

func (FunctionWrapper) GetFunction

func (wrapper FunctionWrapper) GetFunction(ctx context.Context, functionName string) types.State

GetFunction gets data about the Lambda function specified by functionName.

func (FunctionWrapper) Invoke

func (wrapper FunctionWrapper) Invoke(ctx context.Context, functionName string, parameters any, getLog bool) *lambda.InvokeOutput

Invoke invokes the Lambda function specified by functionName, passing the parameters as a JSON payload. When getLog is true, types.LogTypeTail is specified, which tells Lambda to include the last few log lines in the returned result.

func (FunctionWrapper) ListFunctions

func (wrapper FunctionWrapper) ListFunctions(ctx context.Context, maxItems int) []types.FunctionConfiguration

ListFunctions lists up to maxItems functions for the account. This function uses a lambda.ListFunctionsPaginator to paginate the results.

func (FunctionWrapper) UpdateFunctionCode

func (wrapper FunctionWrapper) UpdateFunctionCode(ctx context.Context, functionName string, zipPackage *bytes.Buffer) types.State

UpdateFunctionCode updates the code for the Lambda function specified by functionName. The existing code for the Lambda function is entirely replaced by the code in the zipPackage buffer. After the update action is called, a lambda.FunctionUpdatedV2Waiter is used to wait until the update is successful.

func (FunctionWrapper) UpdateFunctionConfiguration

func (wrapper FunctionWrapper) UpdateFunctionConfiguration(ctx context.Context, functionName string, envVars map[string]string)

UpdateFunctionConfiguration updates a map of environment variables configured for the Lambda function specified by functionName.

type IncrementParameters

type IncrementParameters struct {
	Action string `json:"action"`
	Number int    `json:"number"`
}

IncrementParameters is used to serialize parameters to the increment Lambda handler.

type LambdaResultFloat

type LambdaResultFloat struct {
	Result float32 `json:"result"`
}

LambdaResultFloat is used to deserialize a float32 result from a Lambda handler.

type LambdaResultInt

type LambdaResultInt struct {
	Result int `json:"result"`
}

LambdaResultInt is used to deserialize an int result from a Lambda handler.

Jump to

Keyboard shortcuts

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