localstack

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRegion is the default region used by localstack.
	DefaultRegion = "us-west-2"
	// Endpoint is the localstack endpoint.
	Endpoint = "http://localhost:4566"
	// Env is the environment variable name for the localstack use.  If set, the aws
	// library uses the localstack emulator.  The preferred way to set this variable is to use
	// `localstack.Use()` and `localstack.UseNot()`.
	Env = config.Env
)

Variables

View Source
var ErrInvalidBucketName = errors.New("invalid bucket name")

ErrInvalidBucketName is returned when the bucket name is invalid.

Functions

func Call

func Call(args ...string) ([]byte, error)

Call is the equivalent to call `awslocal` from the command line.

func CallSilent

func CallSilent(args ...string) ([]byte, error)

CallSilent is the equivalent to call `awslocal` from the command line.

func CreateBucket

func CreateBucket(bktName string, opt ...Option) error

CreateBucket creates the bucket `bktName` on the localstack. For testing purpose exclusively. It supports the option WithNoErrorIfExist.

func CreateBucketAt

func CreateBucketAt(bktName string, region string, opt ...Option) error

CreateBucketAt creates the bucket `bktName` on the localstack in the AWS region. For testing purpose exclusively. It supports the option WithNoErrorIfExist.

func DeleteBucket

func DeleteBucket(bktName string) error

DeleteBucket deletes the bucket `bktName` on the localstack.

func DeleteBucketAt

func DeleteBucketAt(bktName string, region string) error

DeleteBucketAt deletes the bucket `bktName` on the localstack. The bucket does not need to be empty.

func InUse

func InUse() bool

InUse returns true if the application uses the localstack emulator. LocalStack may run but not used by the application.

func IsBucketNameValid

func IsBucketNameValid(b string) bool

IsBucketNameValid returns true if the bucket name is syntactically valid.

func IsExist

func IsExist(objectPath string) bool

IsExist checks whether the object `objectPath` exists on the localstack.

func IsRunning

func IsRunning() bool

IsRunning checks if the localstack is running.

func PutObject

func PutObject(objectPath string, source string) error

PutObject pushes the file `source` on the localstack as object `objectPath`. For testing purpose exclusively. If it is already in the bucket, the operation is skipped.

func Use

func Use() error

Use indicates that the localstack emulator should be used.

func UseNot

func UseNot() error

UseNot indicates that the localstack emulator should not be used anymore.

Types

type Option

type Option func(opts *options)

Option allows parameterizing function

func WithEnvironmentVariable

func WithEnvironmentVariable(key, value string) Option

WithEnvironmentVariable allows to set environment variables

func WithNoErrorIfExist

func WithNoErrorIfExist() Option

WithNoErrorIfExist filters out the error if the bucket to be created already exists.

Directories

Path Synopsis
Package exec provides a set of system-related functions such a Run that runs an application.
Package exec provides a set of system-related functions such a Run that runs an application.

Jump to

Keyboard shortcuts

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