Documentation ¶
Overview ¶
Package localstack provides a Gnomock Preset for localstack project (https://github.com/localstack/localstack). It allows to easily setup local AWS stack for testing
Index ¶
Constants ¶
const (
// APIPort should be used to configure AWS SDK endpoint.
APIPort = "api"
)
Variables ¶
This section is empty.
Functions ¶
func 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.
Types ¶
type Option ¶
type Option func(*P)
Option is an optional configuration of this Gnomock preset. Use available Options to configure the container.
func WithS3Files ¶
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 ¶
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 ¶ added in v0.9.0
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) 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 ¶
UnmarshalJSON allows to unmarshal string into Service type.