Back to

Package localstack

Latest Go to latest

The latest major version is .

Published: Jun 19, 2020 | License: MIT | Module:


Package localstack provides a Gnomock Preset for localstack project ( It allows to easily setup local AWS stack for testing



const (

	// APIPort should be used to configure AWS SDK endpoint
	APIPort = "api"

func Preset

func Preset(opts ...Option) gnomock.Preset

Preset creates a new localstack preset to use with gnomock.Start. See package docs for a list of exposed ports and services. It is legal to not provide any services using WithServices options, but in such case a new localstack container will be useless.

This Preset cannot be used with localstack image prior to 0.11.0

type Option

type Option func(*P)

Option is an optional configuration of this Gnomock preset. Use available Options to configure the container

func WithS3Files

func WithS3Files(path string) Option

WithS3Files sets up S3 service running in localstack with the contents of `path` directory. The first level children of `path` must be directories, their names will be used to create buckets. Below them, all the files in any other directories, these files will be uploaded as-is.

For example, if you put your test files in testdata/my-bucket/dir/, Gnomock will create "my-bucket" for you, and pull "dir" with all its contents into this bucket.

This function does nothing if you don't provide localstack.S3 as one of the services in WithServices

func WithServices

func WithServices(services ...Service) Option

WithServices selects localstack services to spin up. It is OK to not select any services, but in such case the container will be useless

func WithVersion

func WithVersion(version string) Option

WithVersion sets image version.

type P

type P struct {
	Services []Service `json:"services"`
	S3Path   string    `json:"s3_path"`
	Version  string    `json:"version"`

P is a Gnomock Preset localstack implementation

func (*P) Image

func (p *P) Image() string

Image returns an image that should be pulled to create this container

func (*P) Options

func (p *P) Options() []gnomock.Option

Options returns a list of options to configure this container

func (*P) Ports

func (p *P) Ports() gnomock.NamedPorts

Ports returns ports that should be used to access this container

type Service

type Service string

Service represents an AWS service that can be setup using localstack

const (
	APIGateway       Service = "apigateway"
	CloudFormation   Service = "cloudformation"
	CloudWatch       Service = "cloudwatch"
	CloudWatchLogs   Service = "logs"
	CloudWatchEvents Service = "events"
	DynamoDB         Service = "dynamodb"
	DynamoDBStreams  Service = "dynamodbstreams"
	EC2              Service = "ec2"
	ES               Service = "es"
	Firehose         Service = "firehose"
	IAM              Service = "iam"
	Kinesis          Service = "kinesis"
	KMS              Service = "kms"
	Lambda           Service = "lambda"
	Redshift         Service = "redshift"
	Route53          Service = "route53"
	S3               Service = "s3"
	SecretsManager   Service = "secretsmanager"
	SES              Service = "ses"
	SNS              Service = "sns"
	SQS              Service = "sqs"
	SSM              Service = "ssm"
	STS              Service = "sts"
	StepFunctions    Service = "stepfunctions"

These services are available in this Preset

func (*Service) UnmarshalJSON

func (s *Service) UnmarshalJSON(bs []byte) error

UnmarshalJSON allows to unmarshal string into Service type

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier