Skip to content

Commit

Permalink
add setting lambda function memory size
Browse files Browse the repository at this point in the history
  • Loading branch information
ianic committed Dec 6, 2021
1 parent eb6e7d4 commit 2a6f645
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions aws/lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ func (l *Lambda) Info(name string) (map[string]string, error) {
return nil, err
}

func (l *Lambda) SetMemory(name string, mem int) error {
input := lambda.UpdateFunctionConfigurationInput{
FunctionName: aws.String(name),
MemorySize: aws.Int32(int32(mem)),
}
output, err := l.cli.UpdateFunctionConfiguration(context.Background(), &input)
if err == nil {
return err
}
if output.MemorySize == nil {
return fmt.Errorf("output memory size not found")
}
if int(*output.MemorySize) != mem {
return fmt.Errorf("expected mem %d actual %d", mem, output.MemorySize)
}
return nil
}

func (l *Lambda) Invoke(name string, req, rsp interface{}, headers map[string]string) error {
var payload []byte
if req != nil {
Expand Down

0 comments on commit 2a6f645

Please sign in to comment.