Documentation
¶
Index ¶
- Constants
- type ConnectionConfig
- type DynamoDBTable
- type ECSContainer
- type ECSPort
- type ECSRunTask
- type ECSService
- type EventBus
- type Image
- type KinesisStream
- type Option
- func WithACM() Option
- func WithAPIGateway() Option
- func WithAPIGatewayV2() Option
- func WithAccount() Option
- func WithAll() Option
- func WithAppConfig() Option
- func WithAppSync() Option
- func WithAthena() Option
- func WithAutoScaling() Option
- func WithBackup() Option
- func WithBatch() Option
- func WithCloudFormation() Option
- func WithCloudFront() Option
- func WithCloudFrontKeyValueStore() Option
- func WithCloudWatch() Option
- func WithCloudWatchLogs() Option
- func WithCodeBuild() Option
- func WithCognitoIdentityPools() Option
- func WithCognitoUserPools() Option
- func WithCredentials(accessKey string, secretKey string) Option
- func WithDockerNetwork(network string) Option
- func WithDockerSocket() Option
- func WithDockerfileImage(dockerfile string, ecsImage string) Option
- func WithDynamoDB(tables ...DynamoDBTable) Option
- func WithEC2() Option
- func WithECR() Option
- func WithECS() Option
- func WithECSCluster(name string) Option
- func WithECSRunTask(task ECSRunTask) Option
- func WithECSService(service ECSService) Option
- func WithEFS() Option
- func WithEKS() Option
- func WithELBv2() Option
- func WithEMR() Option
- func WithElastiCache() Option
- func WithEnv(env map[string]string) Option
- func WithEventBridge(buses ...EventBus) Option
- func WithEventBridgeScheduler() Option
- func WithFirehose() Option
- func WithGlue() Option
- func WithIAM() Option
- func WithIMDS() Option
- func WithKMS() Option
- func WithKinesis(streams ...KinesisStream) Option
- func WithLambda() Option
- func WithLocalImage(localImage string, ecsImage string) Option
- func WithOpenSearch() Option
- func WithOrganizations() Option
- func WithPipes() Option
- func WithRDS() Option
- func WithRDSData() Option
- func WithRegion(region string) Option
- func WithRegistry(hostPort string) Option
- func WithRegistryImage(image string, tag string) Option
- func WithResourceGroupsTagging() Option
- func WithRoute53() Option
- func WithS3(buckets ...string) Option
- func WithS3Bucket(bucket string) Option
- func WithS3Files() Option
- func WithSES() Option
- func WithSNS(topics ...string) Option
- func WithSNSTopic(topic string) Option
- func WithSQS(queues ...string) Option
- func WithSQSQueue(queue string) Option
- func WithSSM(parameters ...Parameter) Option
- func WithSTS() Option
- func WithSecretsManager(secrets ...Secret) Option
- func WithServiceDiscovery() Option
- func WithServices(services ...string) Option
- func WithStepFunctions() Option
- func WithTransfer() Option
- func WithWAFClassic() Option
- func WithWAFv2() Option
- type Parameter
- type PushedImage
- type Secret
- type Stack
- func (s *Stack) AWSConfig(ctx context.Context) (awssdk.Config, error)
- func (s *Stack) BuildAndPushImage(ctx context.Context, dockerfile string, ecsImage string) (PushedImage, string, error)
- func (s *Stack) Cleanup(ctx context.Context) error
- func (s *Stack) ContainerConnection() ConnectionConfig
- func (s *Stack) ContainerEnv() map[string]string
- func (s *Stack) Create(ctx context.Context) error
- func (s *Stack) DynamoDBClient(ctx context.Context) (*dynamodb.Client, error)
- func (s *Stack) ECSClient(ctx context.Context) (*ecs.Client, error)
- func (s *Stack) EndpointURL() string
- func (s *Stack) Endpoints() map[string]string
- func (s *Stack) Env() map[string]string
- func (s *Stack) EventBridgeClient(ctx context.Context) (*eventbridge.Client, error)
- func (s *Stack) HostConnection() ConnectionConfig
- func (s *Stack) HostEnv() map[string]string
- func (s *Stack) InternalEndpointURL() string
- func (s *Stack) KinesisClient(ctx context.Context) (*kinesis.Client, error)
- func (s *Stack) LambdaClient(ctx context.Context) (*lambda.Client, error)
- func (s *Stack) Logs(ctx context.Context) (logs.LogStreams, error)
- func (s *Stack) Name() string
- func (s *Stack) PushImage(ctx context.Context, localImage string, ecsImage string) (PushedImage, error)
- func (s *Stack) QueueURL(name string) (string, bool)
- func (s *Stack) RegistryAddress() string
- func (s *Stack) RegistryDockerConfigJSON() ([]byte, error)
- func (s *Stack) RegistryEnv() map[string]string
- func (s *Stack) RegistryImage(image string) string
- func (s *Stack) S3Client(ctx context.Context) (*s3.Client, error)
- func (s *Stack) SNSClient(ctx context.Context) (*sns.Client, error)
- func (s *Stack) SQSClient(ctx context.Context) (*sqs.Client, error)
- func (s *Stack) SSMClient(ctx context.Context) (*ssm.Client, error)
- func (s *Stack) SecretsManagerClient(ctx context.Context) (*secretsmanager.Client, error)
- func (s *Stack) SetLabels(labels map[string]string)
- func (s *Stack) SetNamePrefix(prefix string)
- func (s *Stack) SetNetwork(name string)
- func (s *Stack) TopicARN(name string) (string, bool)
Constants ¶
const ( // ECSLaunchTypeEC2 runs the task through MiniStack's Docker-backed EC2 mode. ECSLaunchTypeEC2 = "EC2" // ECSLaunchTypeFargate marks the task as Fargate-compatible. MiniStack // still runs the container through the host Docker daemon. ECSLaunchTypeFargate = "FARGATE" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionConfig ¶
type ConnectionConfig struct {
EndpointURL string
Region string
AccessKeyID string
SecretAccessKey string
S3ForcePathStyle bool
}
ConnectionConfig describes how an application should connect to the MiniStack AWS endpoint.
func (ConnectionConfig) Env ¶
func (c ConnectionConfig) Env() map[string]string
Env returns common AWS environment variables for SDKs and application frameworks. Path-style keys are included because S3-compatible local endpoints usually cannot serve virtual-hosted bucket names.
type DynamoDBTable ¶
DynamoDBTable describes a simple DynamoDB table to create. Keys are string attributes; PartitionKey defaults to "id" when blank.
type ECSContainer ¶
type ECSContainer struct {
Name string
Image string
LocalImage string
Dockerfile string
Command []string
Env map[string]string
Ports []ECSPort
CPU int32
Memory int32
Essential *bool
}
ECSContainer describes one container in an ECS task definition. Image may point at a public image. LocalImage or Dockerfile pushes an image into the local registry and uses that pushed image in the task definition.
type ECSRunTask ¶
type ECSRunTask struct {
Name string
Cluster string
Family string
LaunchType string
Count int32
CPU string
Memory string
Containers []ECSContainer
}
ECSRunTask describes an ECS task to register and run once during stack startup.
type ECSService ¶
type ECSService struct {
Name string
Cluster string
Family string
LaunchType string
DesiredCount int32
CPU string
Memory string
Containers []ECSContainer
}
ECSService describes a long-running ECS service backed by MiniStack's Docker execution.
type EventBus ¶
type EventBus struct {
Name string
}
EventBus describes an EventBridge event bus to create.
type Image ¶
Image describes a container image that should be made available through the local registry before MiniStack ECS resources are created.
type KinesisStream ¶
KinesisStream describes a Kinesis stream to create.
type Option ¶
type Option func(*Stack)
Option configures the AWS stack before it starts.
func WithAll ¶
func WithAll() Option
WithAll enables every MiniStack service known to this toolbox module.
func WithCloudFormation ¶
func WithCloudFormation() Option
WithCloudFormation enables CloudFormation.
func WithCloudFrontKeyValueStore ¶
func WithCloudFrontKeyValueStore() Option
WithCloudFrontKeyValueStore enables the CloudFront KeyValueStore data plane.
func WithCloudWatch ¶
func WithCloudWatch() Option
WithCloudWatch enables CloudWatch metrics and alarms.
func WithCloudWatchLogs ¶
func WithCloudWatchLogs() Option
WithCloudWatchLogs enables CloudWatch Logs.
func WithCognitoIdentityPools ¶
func WithCognitoIdentityPools() Option
WithCognitoIdentityPools enables Cognito identity pools.
func WithCognitoUserPools ¶
func WithCognitoUserPools() Option
WithCognitoUserPools enables Cognito user pools.
func WithCredentials ¶
WithCredentials sets the fake credentials used by generated SDK clients. MiniStack accepts dummy credentials, so these are for application config compatibility.
func WithDockerNetwork ¶
WithDockerNetwork sets the Docker network MiniStack should use for container-backed AWS services. It also mounts the Docker socket because MiniStack needs Docker access to create those backing services.
func WithDockerSocket ¶
func WithDockerSocket() Option
WithDockerSocket mounts the local Docker socket into MiniStack. This is needed for MiniStack features that create real backing containers, such as RDS, ElastiCache, ECS, and Lambda Docker execution.
func WithDockerfileImage ¶
WithDockerfileImage builds a Dockerfile and pushes the result into the local registry before ECS resources are created.
func WithDynamoDB ¶
func WithDynamoDB(tables ...DynamoDBTable) Option
WithDynamoDB enables DynamoDB and optionally creates simple string-key tables after MiniStack starts.
func WithECS ¶
func WithECS() Option
WithECS enables ECS. Use WithDockerSocket or WithDockerNetwork when tasks need MiniStack to create Docker containers.
func WithECSCluster ¶
WithECSCluster creates an ECS cluster after MiniStack starts.
func WithECSRunTask ¶
func WithECSRunTask(task ECSRunTask) Option
WithECSRunTask registers a task definition and runs it once during stack startup. Set LaunchType to ECSLaunchTypeFargate to model a Fargate task.
func WithECSService ¶
func WithECSService(service ECSService) Option
WithECSService registers a task definition and creates a long-running ECS service. Set LaunchType to ECSLaunchTypeFargate to model a Fargate task.
func WithElastiCache ¶
func WithElastiCache() Option
WithElastiCache enables ElastiCache. Use WithDockerSocket or WithDockerNetwork when cache dataplanes should be backed by real containers.
func WithEnv ¶
WithEnv adds MiniStack environment variables. Use this for service flags such as persistence, debug logging, or real sidecar-backed dataplanes.
func WithEventBridge ¶
WithEventBridge enables EventBridge and optionally creates event buses after MiniStack starts.
func WithEventBridgeScheduler ¶
func WithEventBridgeScheduler() Option
WithEventBridgeScheduler enables EventBridge Scheduler.
func WithKinesis ¶
func WithKinesis(streams ...KinesisStream) Option
WithKinesis enables Kinesis and optionally creates streams after MiniStack starts.
func WithLocalImage ¶
WithLocalImage tags and pushes an existing local Docker image into the local registry before ECS resources are created.
func WithRDS ¶
func WithRDS() Option
WithRDS enables RDS. Use WithDockerSocket or WithDockerNetwork when database dataplanes should be backed by real containers.
func WithRegion ¶
WithRegion sets the AWS region used by generated SDK clients.
func WithRegistry ¶
WithRegistry starts a local Docker registry for ECS task images. hostPort may be blank to let Docker assign a free host port.
func WithRegistryImage ¶
WithRegistryImage changes the local registry container image.
func WithResourceGroupsTagging ¶
func WithResourceGroupsTagging() Option
WithResourceGroupsTagging enables the Resource Groups Tagging API.
func WithS3Bucket ¶
WithS3Bucket registers an S3 bucket to create after MiniStack is ready.
func WithS3Files ¶
func WithS3Files() Option
WithS3Files enables the S3 Files compatibility service.
func WithSNSTopic ¶
WithSNSTopic registers an SNS topic to create after MiniStack is ready.
func WithSQSQueue ¶
WithSQSQueue registers an SQS queue to create after MiniStack is ready.
func WithSecretsManager ¶
WithSecretsManager enables Secrets Manager and optionally creates string secrets after MiniStack starts.
func WithServiceDiscovery ¶
func WithServiceDiscovery() Option
WithServiceDiscovery enables Cloud Map service discovery.
func WithServices ¶
WithServices enables raw MiniStack service names. Prefer typed With<Service> helpers when one exists; keep this for escape hatches and newly added MiniStack services.
type PushedImage ¶
type PushedImage struct {
HostImage string
}
PushedImage describes an image pushed to the local registry. HostImage is the image reference ECS task definitions should use because MiniStack asks the host Docker daemon to run ECS containers.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack is a MiniStack-backed AWS development stack. It starts MiniStack, then creates the requested local AWS resources so application code can use normal AWS SDK clients without touching real cloud accounts.
func NewStack ¶
NewStack creates a MiniStack-backed AWS service. MiniStack provides a single local AWS endpoint on port 4566; options define which resources Scaffold should create after the emulator is ready.
func (*Stack) BuildAndPushImage ¶
func (s *Stack) BuildAndPushImage(ctx context.Context, dockerfile string, ecsImage string) (PushedImage, string, error)
BuildAndPushImage builds a Dockerfile, pushes the result to the registry, and returns the image reference ECS task definitions should use.
func (*Stack) ContainerConnection ¶
func (s *Stack) ContainerConnection() ConnectionConfig
ContainerConnection returns connection settings for applications running in another container on the same Docker network as MiniStack.
func (*Stack) ContainerEnv ¶
ContainerEnv returns environment variables for applications running in another container on the same Docker network as MiniStack.
func (*Stack) DynamoDBClient ¶
DynamoDBClient returns a DynamoDB client configured for MiniStack.
func (*Stack) EndpointURL ¶
EndpointURL returns the local MiniStack edge endpoint.
func (*Stack) EventBridgeClient ¶
EventBridgeClient returns an EventBridge client configured for MiniStack.
func (*Stack) HostConnection ¶
func (s *Stack) HostConnection() ConnectionConfig
HostConnection returns connection settings for applications running on the host machine.
func (*Stack) HostEnv ¶
HostEnv returns environment variables for applications running on the host machine.
func (*Stack) InternalEndpointURL ¶
InternalEndpointURL returns the Docker-network endpoint for MiniStack. It is reachable by sibling containers only when they share a user-defined Docker network with this stack.
func (*Stack) KinesisClient ¶
KinesisClient returns a Kinesis client configured for MiniStack.
func (*Stack) LambdaClient ¶
LambdaClient returns a Lambda client configured for MiniStack.
func (*Stack) PushImage ¶
func (s *Stack) PushImage(ctx context.Context, localImage string, ecsImage string) (PushedImage, error)
PushImage tags a local image, pushes it to the registry, and returns the image reference ECS task definitions should use.
func (*Stack) RegistryAddress ¶
RegistryAddress returns the host-reachable registry address.
func (*Stack) RegistryDockerConfigJSON ¶
RegistryDockerConfigJSON returns a Docker config.json payload for the host-reachable registry. The default registry has no authentication.
func (*Stack) RegistryEnv ¶
RegistryEnv returns environment variables useful for CLI commands that build, tag, push, or register ECS task images.
func (*Stack) RegistryImage ¶
RegistryImage returns the image reference ECS task definitions should use.
func (*Stack) SecretsManagerClient ¶
SecretsManagerClient returns a Secrets Manager client configured for MiniStack.
func (*Stack) SetNamePrefix ¶
SetNamePrefix prefixes the MiniStack Docker container name.
func (*Stack) SetNetwork ¶
SetNetwork attaches MiniStack to a shared Docker network.