floci

package module
v0.0.0-...-4705faa Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 10 Imported by: 0

README

testcontainers-floci-go

Go Reference CI

Go Testcontainers module for Floci — the open-source, drop-in replacement for LocalStack Community Edition.

Floci emulates 42 AWS services in a single container with:

  • ~24 ms startup time (native image)
  • ~13 MiB idle memory
  • ~90 MB Docker image
  • No auth tokens, no feature gates, MIT license

Installation

go get github.com/floci-io/testcontainers-floci-go

Requires Go 1.25+ and a running Docker daemon.

Quick start

package myservice_test

import (
    "context"
    "strings"
    "testing"

    "github.com/aws/aws-sdk-go-v2/aws"
    "github.com/aws/aws-sdk-go-v2/config"
    "github.com/aws/aws-sdk-go-v2/credentials"
    "github.com/aws/aws-sdk-go-v2/service/s3"

    floci "github.com/floci-io/testcontainers-floci-go"
)

func TestS3(t *testing.T) {
    ctx := context.Background()

    fc, err := floci.NewFlociContainer().Start(ctx)
    if err != nil {
        t.Fatal(err)
    }
    t.Cleanup(func() { _ = fc.Stop(ctx) })

    cfg, err := config.LoadDefaultConfig(ctx,
        config.WithRegion(fc.GetRegion()),
        config.WithBaseEndpoint(fc.GetEndpoint()),
        config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(
            fc.GetAccessKey(), fc.GetSecretKey(), "",
        )),
    )
    if err != nil {
        t.Fatal(err)
    }

    client := s3.NewFromConfig(cfg, func(o *s3.Options) {
        o.UsePathStyle = true // required for local endpoints
    })

    _, err = client.CreateBucket(ctx, &s3.CreateBucketInput{
        Bucket: aws.String("my-bucket"),
    })
    if err != nil {
        t.Fatal(err)
    }

    _, err = client.PutObject(ctx, &s3.PutObjectInput{
        Bucket: aws.String("my-bucket"),
        Key:    aws.String("hello.txt"),
        Body:   strings.NewReader("hello from floci"),
    })
    if err != nil {
        t.Fatal(err)
    }

    out, err := client.ListObjectsV2(ctx, &s3.ListObjectsV2Input{
        Bucket: aws.String("my-bucket"),
    })
    if err != nil {
        t.Fatal(err)
    }

    t.Logf("objects: %d", len(out.Contents))
}

S3 note: always use strings.NewReader or bytes.NewReader (seekable) when uploading objects. bytes.NewBufferString is not seekable and causes the AWS SDK to attempt trailing checksums, which require TLS and fail against a plain HTTP local endpoint.

Sharing a container across tests

Use TestMain to start the container once for the whole package:

package myservice_test

import (
    "context"
    "os"
    "testing"

    floci "github.com/floci-io/testcontainers-floci-go"
)

var fc *floci.StartedFlociContainer

func TestMain(m *testing.M) {
    ctx := context.Background()
    var err error
    fc, err = floci.NewFlociContainer().Start(ctx)
    if err != nil {
        panic(err)
    }
    code := m.Run()
    _ = fc.Stop(ctx)
    os.Exit(code)
}

Service configuration

Each of Floci's 42 services can be configured individually using typed config structs. Pass any struct to the corresponding With*Config method — unset fields keep their defaults.

S3
fc, _ := floci.NewFlociContainer().
    WithS3Config(floci.S3Config{
        Enabled:                     true,
        DefaultPresignExpirySeconds: 7200,
    }).
    Start(ctx)
SQS
fc, _ := floci.NewFlociContainer().
    WithSqsConfig(floci.SqsConfig{
        Enabled:                  true,
        DefaultVisibilityTimeout: 60,
        MaxMessageSize:           262144,
    }).
    Start(ctx)
DynamoDB
fc, _ := floci.NewFlociContainer().
    WithDynamoDbConfig(floci.DynamoDbConfig{Enabled: true}).
    Start(ctx)
Lambda
fc, _ := floci.NewFlociContainer().
    WithDedicatedNetwork(). // required for Lambda to reach Floci
    WithLambdaConfig(floci.LambdaConfig{
        Enabled:               true,
        DefaultMemoryMb:       256,
        DefaultTimeoutSeconds: 30,
        HotReloadEnabled:      true,
        ExposeRuntimePorts:    true, // invoke Lambdas from the host
    }).
    Start(ctx)
RDS (PostgreSQL / MySQL / MariaDB)
fc, _ := floci.NewFlociContainer().
    WithDedicatedNetwork().
    WithRdsConfig(floci.RdsConfig{
        Enabled:              true,
        DefaultPostgresImage: "postgres:16-alpine",
    }).
    Start(ctx)
ElastiCache (Redis / Valkey)
fc, _ := floci.NewFlociContainer().
    WithDedicatedNetwork().
    WithElastiCacheConfig(floci.ElastiCacheConfig{
        Enabled:      true,
        DefaultImage: "valkey/valkey:8",
    }).
    Start(ctx)
OpenSearch
fc, _ := floci.NewFlociContainer().
    WithDedicatedNetwork().
    WithOpenSearchConfig(floci.OpenSearchConfig{
        Enabled: true,
        Mock:    false,
    }).
    Start(ctx)
MSK (Kafka via Redpanda)
fc, _ := floci.NewFlociContainer().
    WithDedicatedNetwork().
    WithMskConfig(floci.MskConfig{
        Enabled:      true,
        DefaultImage: "redpandadata/redpanda:latest",
    }).
    Start(ctx)
All available config structs
Struct AWS service
AcmConfig AWS Certificate Manager
ApiGatewayConfig API Gateway (v1)
ApiGatewayV2Config API Gateway (v2)
AppConfigConfig AppConfig
AppConfigDataConfig AppConfig Data
AthenaConfig Athena
BedrockRuntimeConfig Bedrock Runtime
CloudFormationConfig CloudFormation
CloudWatchLogsConfig CloudWatch Logs
CloudWatchMetricsConfig CloudWatch Metrics
CodeBuildConfig CodeBuild
CodeDeployConfig CodeDeploy
CognitoConfig Cognito
DynamoDbConfig DynamoDB
Ec2Config EC2
EcrConfig ECR
EcsConfig ECS
EksConfig EKS
ElastiCacheConfig ElastiCache
ElbV2Config ELB v2
EventBridgeConfig EventBridge
FirehoseConfig Kinesis Firehose
GlueConfig Glue
IamConfig IAM
KinesisConfig Kinesis
KmsConfig KMS
LambdaConfig Lambda
MskConfig MSK (Kafka)
OpenSearchConfig OpenSearch
PipesConfig EventBridge Pipes
RdsConfig RDS
ResourceGroupsTaggingConfig Resource Groups Tagging
S3Config S3
SchedulerConfig EventBridge Scheduler
SecretsManagerConfig Secrets Manager
SesConfig SES
SesV2Config SES v2
SnsConfig SNS
SqsConfig SQS
SsmConfig SSM Parameter Store
StepFunctionsConfig Step Functions

Container options

fc, _ := floci.NewFlociContainer().
    WithImage("floci/floci:latest").   // pin a specific tag
    WithRegion("eu-west-1").
    WithAccountID("111122223333").
    WithAvailabilityZone("eu-west-1a").
    WithDedicatedNetwork().            // isolated Docker network for stateful services
    Start(ctx)
Connection details
Method Returns
GetEndpoint() http://host:port — pass as base endpoint to AWS SDK clients
GetRegion() AWS region string
GetAccessKey() Access key ("test")
GetSecretKey() Secret key ("test")
GetAccountID() AWS account ID
GetAvailabilityZone() Availability zone
GetDedicatedNetworkName() Docker network name (empty if none)
GetMappedPort(ctx, port) Host port mapped from the given container port

Dedicated network

Services that spawn real Docker containers (Lambda, RDS, ElastiCache, MSK, OpenSearch, ECR, EKS) need a Docker network to communicate with Floci. Call WithDedicatedNetwork() to have the module create and manage one automatically:

fc, _ := floci.NewFlociContainer().
    WithDedicatedNetwork().
    WithLambdaConfig(floci.LambdaConfig{Enabled: true}).
    Start(ctx)

// The network name is passed to Floci automatically via FLOCI_SERVICES_DOCKER_NETWORK.
// fc.GetDedicatedNetworkName() returns it if you need it elsewhere.

The network is removed when Stop is called.

Docker image variants

Tag Description
floci/floci:latest Native image — sub-second startup (recommended)
floci/floci:x.y.z Pinned release
floci/floci:latest-compat Includes Python 3, AWS CLI, and boto3
floci/floci:nightly Latest nightly build from main

Requirements

  • Go 1.25+
  • Docker (running locally or in CI)
  • github.com/testcontainers/testcontainers-go v0.42.0

Examples

Running the tests

go test -v ./...

Requires Docker running locally; the floci/floci:latest image is pulled automatically on first run.

License

MIT

Documentation

Overview

Package floci provides a Testcontainers module for Floci — a free, open-source local AWS emulator.

Example:

fc, err := floci.Run(ctx)
if err != nil { ... }
defer fc.Stop(ctx)

cfg, _ := config.LoadDefaultConfig(ctx,
    config.WithRegion(fc.GetRegion()),
    config.WithBaseEndpoint(fc.GetEndpoint()),
    config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(
        fc.GetAccessKey(), fc.GetSecretKey(), "",
    )),
)

Index

Constants

View Source
const (
	DefaultRegion           = "us-east-1"
	DefaultAvailabilityZone = "us-east-1a"
	DefaultAccountID        = "000000000000"
	DefaultAccessKey        = "test"
	DefaultSecretKey        = "test"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AcmConfig

type AcmConfig struct {
	Enabled               bool
	ValidationWaitSeconds int
}

AcmConfig configures the ACM (AWS Certificate Manager) service.

func DefaultAcmConfig

func DefaultAcmConfig() AcmConfig

type ApiGatewayConfig

type ApiGatewayConfig struct {
	Enabled bool
}

ApiGatewayConfig configures the API Gateway service.

func DefaultApiGatewayConfig

func DefaultApiGatewayConfig() ApiGatewayConfig

type ApiGatewayV2Config

type ApiGatewayV2Config struct {
	Enabled bool
}

ApiGatewayV2Config configures the API Gateway V2 service.

func DefaultApiGatewayV2Config

func DefaultApiGatewayV2Config() ApiGatewayV2Config

type AppConfigConfig

type AppConfigConfig struct {
	Enabled bool
}

AppConfigConfig configures the AppConfig service.

func DefaultAppConfigConfig

func DefaultAppConfigConfig() AppConfigConfig

type AppConfigDataConfig

type AppConfigDataConfig struct {
	Enabled bool
}

AppConfigDataConfig configures the AppConfig Data service.

func DefaultAppConfigDataConfig

func DefaultAppConfigDataConfig() AppConfigDataConfig

type AthenaConfig

type AthenaConfig struct {
	Enabled      bool
	Mock         bool
	DefaultImage string
}

AthenaConfig configures the Athena service.

func DefaultAthenaConfig

func DefaultAthenaConfig() AthenaConfig

type BedrockRuntimeConfig

type BedrockRuntimeConfig struct {
	Enabled bool
}

BedrockRuntimeConfig configures the Bedrock Runtime service.

func DefaultBedrockRuntimeConfig

func DefaultBedrockRuntimeConfig() BedrockRuntimeConfig

type CloudFormationConfig

type CloudFormationConfig struct {
	Enabled bool
}

CloudFormationConfig configures the CloudFormation service.

func DefaultCloudFormationConfig

func DefaultCloudFormationConfig() CloudFormationConfig

type CloudWatchLogsConfig

type CloudWatchLogsConfig struct {
	Enabled           bool
	MaxEventsPerQuery int
}

CloudWatchLogsConfig configures the CloudWatch Logs service.

func DefaultCloudWatchLogsConfig

func DefaultCloudWatchLogsConfig() CloudWatchLogsConfig

type CloudWatchMetricsConfig

type CloudWatchMetricsConfig struct {
	Enabled bool
}

CloudWatchMetricsConfig configures the CloudWatch Metrics service.

func DefaultCloudWatchMetricsConfig

func DefaultCloudWatchMetricsConfig() CloudWatchMetricsConfig

type CodeBuildConfig

type CodeBuildConfig struct {
	Enabled bool
}

CodeBuildConfig configures the CodeBuild service.

func DefaultCodeBuildConfig

func DefaultCodeBuildConfig() CodeBuildConfig

type CodeDeployConfig

type CodeDeployConfig struct {
	Enabled bool
}

CodeDeployConfig configures the CodeDeploy service.

func DefaultCodeDeployConfig

func DefaultCodeDeployConfig() CodeDeployConfig

type CognitoConfig

type CognitoConfig struct {
	Enabled bool
}

CognitoConfig configures the Cognito service.

func DefaultCognitoConfig

func DefaultCognitoConfig() CognitoConfig

type DynamoDbConfig

type DynamoDbConfig struct {
	Enabled bool
}

DynamoDbConfig configures the DynamoDB service.

func DefaultDynamoDbConfig

func DefaultDynamoDbConfig() DynamoDbConfig

type Ec2Config

type Ec2Config struct {
	Enabled  bool
	Mock     bool
	ImdsPort int
}

Ec2Config configures the EC2 service.

func DefaultEc2Config

func DefaultEc2Config() Ec2Config

type EcrConfig

type EcrConfig struct {
	Enabled           bool
	RegistryImage     string
	RegistryBasePort  int
	RegistryPortCount int
	// ExposeRegistryPorts publishes ports [RegistryBasePort,
	// RegistryBasePort+RegistryPortCount) to the host. Enable it only when the
	// registry must be reachable from the host: every published port adds load
	// to Docker's port forwarder, and publishing hundreds by default makes
	// container startup slow and flaky.
	ExposeRegistryPorts bool
}

EcrConfig configures the ECR service. When enabled, ports [RegistryBasePort, RegistryBasePort+RegistryPortCount) are exposed.

func DefaultEcrConfig

func DefaultEcrConfig() EcrConfig

type EcsConfig

type EcsConfig struct {
	Enabled bool
	Mock    bool
}

EcsConfig configures the ECS service.

func DefaultEcsConfig

func DefaultEcsConfig() EcsConfig

type EksConfig

type EksConfig struct {
	Enabled            bool
	Mock               bool
	Provider           string
	DefaultImage       string
	ApiServerBasePort  int
	ApiServerPortCount int
	// ExposeApiServerPorts publishes ports [ApiServerBasePort,
	// ApiServerBasePort+ApiServerPortCount) to the host.
	ExposeApiServerPorts bool
}

EksConfig configures the EKS service. Set ExposeApiServerPorts=true to reach cluster API servers from the host.

func DefaultEksConfig

func DefaultEksConfig() EksConfig

type ElastiCacheConfig

type ElastiCacheConfig struct {
	Enabled        bool
	DefaultImage   string
	ProxyBasePort  int
	ProxyPortCount int
	// ExposeProxyPorts publishes ports [ProxyBasePort,
	// ProxyBasePort+ProxyPortCount) to the host.
	ExposeProxyPorts bool
}

ElastiCacheConfig configures the ElastiCache service. Set ExposeProxyPorts=true to reach cache proxies from the host.

func DefaultElastiCacheConfig

func DefaultElastiCacheConfig() ElastiCacheConfig

type ElbV2Config

type ElbV2Config struct {
	Enabled bool
	Mock    bool
}

ElbV2Config configures the ELBv2 service.

func DefaultElbV2Config

func DefaultElbV2Config() ElbV2Config

type EventBridgeConfig

type EventBridgeConfig struct {
	Enabled bool
}

EventBridgeConfig configures the EventBridge service.

func DefaultEventBridgeConfig

func DefaultEventBridgeConfig() EventBridgeConfig

type FirehoseConfig

type FirehoseConfig struct {
	Enabled bool
}

FirehoseConfig configures the Kinesis Data Firehose service.

func DefaultFirehoseConfig

func DefaultFirehoseConfig() FirehoseConfig

type FlociContainer

type FlociContainer struct {
	// contains filtered or unexported fields
}

FlociContainer is a builder for a Floci testcontainer.

func NewFlociContainer

func NewFlociContainer() *FlociContainer

NewFlociContainer creates a new FlociContainer builder with default configuration.

func (*FlociContainer) Start

Start launches the Floci container and waits for it to be ready.

func (*FlociContainer) WithAccountID

func (c *FlociContainer) WithAccountID(accountID string) *FlociContainer

WithAccountID sets the default AWS account ID.

func (*FlociContainer) WithAcmConfig

func (c *FlociContainer) WithAcmConfig(cfg AcmConfig) *FlociContainer

WithAcmConfig applies ACM service configuration.

func (*FlociContainer) WithApiGatewayConfig

func (c *FlociContainer) WithApiGatewayConfig(cfg ApiGatewayConfig) *FlociContainer

WithApiGatewayConfig applies API Gateway service configuration.

func (*FlociContainer) WithApiGatewayV2Config

func (c *FlociContainer) WithApiGatewayV2Config(cfg ApiGatewayV2Config) *FlociContainer

WithApiGatewayV2Config applies API Gateway V2 service configuration.

func (*FlociContainer) WithAppConfigConfig

func (c *FlociContainer) WithAppConfigConfig(cfg AppConfigConfig) *FlociContainer

WithAppConfigConfig applies AppConfig service configuration.

func (*FlociContainer) WithAppConfigDataConfig

func (c *FlociContainer) WithAppConfigDataConfig(cfg AppConfigDataConfig) *FlociContainer

WithAppConfigDataConfig applies AppConfig Data service configuration.

func (*FlociContainer) WithAthenaConfig

func (c *FlociContainer) WithAthenaConfig(cfg AthenaConfig) *FlociContainer

WithAthenaConfig applies Athena service configuration.

func (*FlociContainer) WithAvailabilityZone

func (c *FlociContainer) WithAvailabilityZone(zone string) *FlociContainer

WithAvailabilityZone sets the default availability zone.

func (*FlociContainer) WithBedrockRuntimeConfig

func (c *FlociContainer) WithBedrockRuntimeConfig(cfg BedrockRuntimeConfig) *FlociContainer

WithBedrockRuntimeConfig applies Bedrock Runtime service configuration.

func (*FlociContainer) WithCloudFormationConfig

func (c *FlociContainer) WithCloudFormationConfig(cfg CloudFormationConfig) *FlociContainer

WithCloudFormationConfig applies CloudFormation service configuration.

func (*FlociContainer) WithCloudWatchLogsConfig

func (c *FlociContainer) WithCloudWatchLogsConfig(cfg CloudWatchLogsConfig) *FlociContainer

WithCloudWatchLogsConfig applies CloudWatch Logs service configuration.

func (*FlociContainer) WithCloudWatchMetricsConfig

func (c *FlociContainer) WithCloudWatchMetricsConfig(cfg CloudWatchMetricsConfig) *FlociContainer

WithCloudWatchMetricsConfig applies CloudWatch Metrics service configuration.

func (*FlociContainer) WithCodeBuildConfig

func (c *FlociContainer) WithCodeBuildConfig(cfg CodeBuildConfig) *FlociContainer

WithCodeBuildConfig applies CodeBuild service configuration.

func (*FlociContainer) WithCodeDeployConfig

func (c *FlociContainer) WithCodeDeployConfig(cfg CodeDeployConfig) *FlociContainer

WithCodeDeployConfig applies CodeDeploy service configuration.

func (*FlociContainer) WithCognitoConfig

func (c *FlociContainer) WithCognitoConfig(cfg CognitoConfig) *FlociContainer

WithCognitoConfig applies Cognito service configuration.

func (*FlociContainer) WithDedicatedNetwork

func (c *FlociContainer) WithDedicatedNetwork() *FlociContainer

WithDedicatedNetwork creates a dedicated Docker network for container-based services (Lambda, RDS, ElastiCache, etc.) to communicate with Floci. The network name is generated at Start() time and automatically passed via FLOCI_SERVICES_DOCKER_NETWORK.

func (*FlociContainer) WithDynamoDbConfig

func (c *FlociContainer) WithDynamoDbConfig(cfg DynamoDbConfig) *FlociContainer

WithDynamoDbConfig applies DynamoDB service configuration.

func (*FlociContainer) WithEc2Config

func (c *FlociContainer) WithEc2Config(cfg Ec2Config) *FlociContainer

WithEc2Config applies EC2 service configuration.

func (*FlociContainer) WithEcrConfig

func (c *FlociContainer) WithEcrConfig(cfg EcrConfig) *FlociContainer

WithEcrConfig applies ECR service configuration.

func (*FlociContainer) WithEcsConfig

func (c *FlociContainer) WithEcsConfig(cfg EcsConfig) *FlociContainer

WithEcsConfig applies ECS service configuration.

func (*FlociContainer) WithEksConfig

func (c *FlociContainer) WithEksConfig(cfg EksConfig) *FlociContainer

WithEksConfig applies EKS service configuration.

func (*FlociContainer) WithElastiCacheConfig

func (c *FlociContainer) WithElastiCacheConfig(cfg ElastiCacheConfig) *FlociContainer

WithElastiCacheConfig applies ElastiCache service configuration.

func (*FlociContainer) WithElbV2Config

func (c *FlociContainer) WithElbV2Config(cfg ElbV2Config) *FlociContainer

WithElbV2Config applies ELBv2 service configuration.

func (*FlociContainer) WithEventBridgeConfig

func (c *FlociContainer) WithEventBridgeConfig(cfg EventBridgeConfig) *FlociContainer

WithEventBridgeConfig applies EventBridge service configuration.

func (*FlociContainer) WithFirehoseConfig

func (c *FlociContainer) WithFirehoseConfig(cfg FirehoseConfig) *FlociContainer

WithFirehoseConfig applies Firehose service configuration.

func (*FlociContainer) WithGlueConfig

func (c *FlociContainer) WithGlueConfig(cfg GlueConfig) *FlociContainer

WithGlueConfig applies Glue service configuration.

func (*FlociContainer) WithIamConfig

func (c *FlociContainer) WithIamConfig(cfg IamConfig) *FlociContainer

WithIamConfig applies IAM service configuration.

func (*FlociContainer) WithImage

func (c *FlociContainer) WithImage(image string) *FlociContainer

WithImage overrides the Docker image used for the container.

func (*FlociContainer) WithKinesisConfig

func (c *FlociContainer) WithKinesisConfig(cfg KinesisConfig) *FlociContainer

WithKinesisConfig applies Kinesis service configuration.

func (*FlociContainer) WithKmsConfig

func (c *FlociContainer) WithKmsConfig(cfg KmsConfig) *FlociContainer

WithKmsConfig applies KMS service configuration.

func (*FlociContainer) WithLambdaConfig

func (c *FlociContainer) WithLambdaConfig(cfg LambdaConfig) *FlociContainer

WithLambdaConfig applies Lambda service configuration.

func (*FlociContainer) WithMskConfig

func (c *FlociContainer) WithMskConfig(cfg MskConfig) *FlociContainer

WithMskConfig applies MSK service configuration.

func (*FlociContainer) WithOpenSearchConfig

func (c *FlociContainer) WithOpenSearchConfig(cfg OpenSearchConfig) *FlociContainer

WithOpenSearchConfig applies OpenSearch service configuration.

func (*FlociContainer) WithPipesConfig

func (c *FlociContainer) WithPipesConfig(cfg PipesConfig) *FlociContainer

WithPipesConfig applies Pipes service configuration.

func (*FlociContainer) WithRdsConfig

func (c *FlociContainer) WithRdsConfig(cfg RdsConfig) *FlociContainer

WithRdsConfig applies RDS service configuration.

func (*FlociContainer) WithRegion

func (c *FlociContainer) WithRegion(region string) *FlociContainer

WithRegion sets the default AWS region.

func (*FlociContainer) WithResourceGroupsTaggingConfig

func (c *FlociContainer) WithResourceGroupsTaggingConfig(cfg ResourceGroupsTaggingConfig) *FlociContainer

WithResourceGroupsTaggingConfig applies Resource Groups Tagging service configuration.

func (*FlociContainer) WithS3Config

func (c *FlociContainer) WithS3Config(cfg S3Config) *FlociContainer

WithS3Config applies S3 service configuration.

func (*FlociContainer) WithSchedulerConfig

func (c *FlociContainer) WithSchedulerConfig(cfg SchedulerConfig) *FlociContainer

WithSchedulerConfig applies Scheduler service configuration.

func (*FlociContainer) WithSecretsManagerConfig

func (c *FlociContainer) WithSecretsManagerConfig(cfg SecretsManagerConfig) *FlociContainer

WithSecretsManagerConfig applies Secrets Manager service configuration.

func (*FlociContainer) WithSesConfig

func (c *FlociContainer) WithSesConfig(cfg SesConfig) *FlociContainer

WithSesConfig applies SES service configuration.

func (*FlociContainer) WithSesV2Config

func (c *FlociContainer) WithSesV2Config(cfg SesV2Config) *FlociContainer

WithSesV2Config applies SES V2 service configuration.

func (*FlociContainer) WithSnsConfig

func (c *FlociContainer) WithSnsConfig(cfg SnsConfig) *FlociContainer

WithSnsConfig applies SNS service configuration.

func (*FlociContainer) WithSqsConfig

func (c *FlociContainer) WithSqsConfig(cfg SqsConfig) *FlociContainer

WithSqsConfig applies SQS service configuration.

func (*FlociContainer) WithSsmConfig

func (c *FlociContainer) WithSsmConfig(cfg SsmConfig) *FlociContainer

WithSsmConfig applies SSM service configuration.

func (*FlociContainer) WithStepFunctionsConfig

func (c *FlociContainer) WithStepFunctionsConfig(cfg StepFunctionsConfig) *FlociContainer

WithStepFunctionsConfig applies Step Functions service configuration.

type GlueConfig

type GlueConfig struct {
	Enabled bool
}

GlueConfig configures the Glue service.

func DefaultGlueConfig

func DefaultGlueConfig() GlueConfig

type IamConfig

type IamConfig struct {
	Enabled            bool
	EnforcementEnabled bool
}

IamConfig configures the IAM service.

func DefaultIamConfig

func DefaultIamConfig() IamConfig

type KinesisConfig

type KinesisConfig struct {
	Enabled bool
}

KinesisConfig configures the Kinesis service.

func DefaultKinesisConfig

func DefaultKinesisConfig() KinesisConfig

type KmsConfig

type KmsConfig struct {
	Enabled bool
}

KmsConfig configures the KMS service.

func DefaultKmsConfig

func DefaultKmsConfig() KmsConfig

type LambdaConfig

type LambdaConfig struct {
	Enabled               bool
	DefaultMemoryMb       int
	DefaultTimeoutSeconds int
	Ephemeral             bool
	HotReloadEnabled      bool
	RuntimeApiBasePort    int
	RuntimeApiPortCount   int
	ExposeRuntimePorts    bool
	DockerNetwork         string
}

LambdaConfig configures the Lambda service. Set ExposeRuntimePorts=true and WithDedicatedNetwork() to invoke Lambdas from the host.

func DefaultLambdaConfig

func DefaultLambdaConfig() LambdaConfig

type MskConfig

type MskConfig struct {
	Enabled      bool
	Mock         bool
	DefaultImage string
}

MskConfig configures the MSK (Managed Streaming for Kafka) service.

func DefaultMskConfig

func DefaultMskConfig() MskConfig

type OpenSearchConfig

type OpenSearchConfig struct {
	Enabled        bool
	Mock           bool
	DefaultImage   string
	ProxyBasePort  int
	ProxyPortCount int
	// ExposeProxyPorts publishes ports [ProxyBasePort,
	// ProxyBasePort+ProxyPortCount) to the host.
	ExposeProxyPorts bool
}

OpenSearchConfig configures the OpenSearch service. Set ExposeProxyPorts=true to reach OpenSearch proxies from the host.

func DefaultOpenSearchConfig

func DefaultOpenSearchConfig() OpenSearchConfig

type Option

type Option func(*FlociContainer)

Option is a functional option for configuring a FlociContainer.

type PipesConfig

type PipesConfig struct {
	Enabled bool
}

PipesConfig configures the Pipes service.

func DefaultPipesConfig

func DefaultPipesConfig() PipesConfig

type RdsConfig

type RdsConfig struct {
	Enabled              bool
	ProxyBasePort        int
	ProxyPortCount       int
	DefaultPostgresImage string
	DefaultMysqlImage    string
	DefaultMariadbImage  string
	// ExposeProxyPorts publishes ports [ProxyBasePort,
	// ProxyBasePort+ProxyPortCount) to the host.
	ExposeProxyPorts bool
}

RdsConfig configures the RDS service. Set ExposeProxyPorts=true for direct DB access from the host.

func DefaultRdsConfig

func DefaultRdsConfig() RdsConfig

type ResourceGroupsTaggingConfig

type ResourceGroupsTaggingConfig struct {
	Enabled bool
}

ResourceGroupsTaggingConfig configures the Resource Groups Tagging service.

func DefaultResourceGroupsTaggingConfig

func DefaultResourceGroupsTaggingConfig() ResourceGroupsTaggingConfig

type S3Config

type S3Config struct {
	Enabled                     bool
	DefaultPresignExpirySeconds int
}

S3Config configures the S3 service.

func DefaultS3Config

func DefaultS3Config() S3Config

type SchedulerConfig

type SchedulerConfig struct {
	Enabled bool
}

SchedulerConfig configures the Scheduler service.

func DefaultSchedulerConfig

func DefaultSchedulerConfig() SchedulerConfig

type SecretsManagerConfig

type SecretsManagerConfig struct {
	Enabled                   bool
	DefaultRecoveryWindowDays int
}

SecretsManagerConfig configures the Secrets Manager service.

func DefaultSecretsManagerConfig

func DefaultSecretsManagerConfig() SecretsManagerConfig

type SesConfig

type SesConfig struct {
	Enabled bool
}

SesConfig configures the SES service.

func DefaultSesConfig

func DefaultSesConfig() SesConfig

type SesV2Config

type SesV2Config struct {
	Enabled bool
}

SesV2Config configures the SES V2 service.

func DefaultSesV2Config

func DefaultSesV2Config() SesV2Config

type SnsConfig

type SnsConfig struct {
	Enabled bool
}

SnsConfig configures the SNS service.

func DefaultSnsConfig

func DefaultSnsConfig() SnsConfig

type SqsConfig

type SqsConfig struct {
	Enabled                  bool
	DefaultVisibilityTimeout int
	MaxMessageSize           int
}

SqsConfig configures the SQS service.

func DefaultSqsConfig

func DefaultSqsConfig() SqsConfig

type SsmConfig

type SsmConfig struct {
	Enabled             bool
	MaxParameterHistory int
}

SsmConfig configures the SSM (Systems Manager / Parameter Store) service.

func DefaultSsmConfig

func DefaultSsmConfig() SsmConfig

type StartedFlociContainer

type StartedFlociContainer struct {
	// contains filtered or unexported fields
}

StartedFlociContainer is a running Floci container instance.

func Run

func Run(ctx context.Context, opts ...Option) (*StartedFlociContainer, error)

Run creates and starts a Floci container, applying the provided options. It is the recommended entry point for starting Floci in tests.

fc, err := floci.Run(ctx)

fc, err := floci.Run(ctx, func(c *floci.FlociContainer) {
    c.WithRegion("eu-west-1")
    c.WithS3Config(floci.S3Config{Enabled: true})
})

func (*StartedFlociContainer) GetAccessKey

func (s *StartedFlociContainer) GetAccessKey() string

GetAccessKey returns the AWS access key (always "test").

func (*StartedFlociContainer) GetAccountID

func (s *StartedFlociContainer) GetAccountID() string

GetAccountID returns the configured AWS account ID.

func (*StartedFlociContainer) GetAvailabilityZone

func (s *StartedFlociContainer) GetAvailabilityZone() string

GetAvailabilityZone returns the configured availability zone.

func (*StartedFlociContainer) GetDedicatedNetworkName

func (s *StartedFlociContainer) GetDedicatedNetworkName() string

GetDedicatedNetworkName returns the dedicated Docker network name, or empty string if none.

func (*StartedFlociContainer) GetEndpoint

func (s *StartedFlociContainer) GetEndpoint() string

GetEndpoint returns the HTTP endpoint for Floci (e.g. "http://localhost:32768").

func (*StartedFlociContainer) GetMappedPort

func (s *StartedFlociContainer) GetMappedPort(ctx context.Context, port int) (int, error)

GetMappedPort returns the host-mapped port for a given container port.

func (*StartedFlociContainer) GetRegion

func (s *StartedFlociContainer) GetRegion() string

GetRegion returns the configured AWS region.

func (*StartedFlociContainer) GetSecretKey

func (s *StartedFlociContainer) GetSecretKey() string

GetSecretKey returns the AWS secret key (always "test").

func (*StartedFlociContainer) Stop

Stop terminates the Floci container and removes any dedicated network.

type StepFunctionsConfig

type StepFunctionsConfig struct {
	Enabled bool
}

StepFunctionsConfig configures the Step Functions service.

func DefaultStepFunctionsConfig

func DefaultStepFunctionsConfig() StepFunctionsConfig

Directories

Path Synopsis
examples
lambda/handler command

Jump to

Keyboard shortcuts

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