Skip to content

Golang library for using AWS Parameters and Secrets Lambda Extension.

License

Notifications You must be signed in to change notification settings

winebarrel/secretlamb

Repository files navigation

secretlamb

CI Go Reference GitHub tag (latest by date) Go Report Card

Golang library for using AWS Parameters and Secrets Lambda Extension.

Installation

go get github.com/winebarrel/secretlamb

Usage

Parameter Store

package main

import (
	"context"
	"fmt"

	"github.com/aws/aws-lambda-go/lambda"
	"github.com/winebarrel/secretlamb"
)

func HandleRequest(ctx context.Context, event any) (*string, error) {
	client := secretlamb.MustNewParameters() // .WithRetry(3)

	v, err := client.Get("foo")
	//v, err := client.GetWithDecryption("foo")

	if err != nil {
		return nil, err
	}

	fmt.Println(v.Parameter.Value)
	return nil, nil
}

func main() {
	lambda.Start(HandleRequest)
}

Secrets Manager

package main

import (
	"context"
	"fmt"

	"github.com/aws/aws-lambda-go/lambda"
	"github.com/winebarrel/secretlamb"
)

func HandleRequest(ctx context.Context, event any) (*string, error) {
	client := secretlamb.MustNewSecrets() // .WithRetry(3)
	v, err := client.Get("foo")

	if err != nil {
		return nil, err
	}

	fmt.Println(v.SecretString)
	return nil, nil
}

func main() {
	lambda.Start(HandleRequest)
}

About

Golang library for using AWS Parameters and Secrets Lambda Extension.

Topics

Resources

License

Stars

Watchers

Forks