Documentation
¶
Overview ¶
Package elasticache provides emulation of Amazon ElastiCache.
Implemented: CreateCacheCluster, DescribeCacheClusters, DeleteCacheCluster, CreateServerlessCache, DescribeServerlessCaches, DeleteServerlessCache, ModifyServerlessCache, ModifyCacheCluster, CreateReplicationGroup, DescribeReplicationGroups, DeleteReplicationGroup, ModifyReplicationGroup, CreateCacheSubnetGroup, DescribeCacheSubnetGroups, DeleteCacheSubnetGroup, CreateCacheParameterGroup, DescribeCacheParameterGroups, DeleteCacheParameterGroup, AddTagsToResource, ListTagsForResource, RemoveTagsFromResource.
On CreateCacheCluster, a real Redis container is started (same pattern as RDS). The cluster reaches "available" state once the TCP health check succeeds.
All other operations return HTTP 501 Not Implemented.
Index ¶
- type CacheCluster
- type CacheParameterGroup
- type CacheSubnetGroup
- type CacheUsageLimits
- type ClusterEndpoint
- type DataStorageLimit
- type ECPULimit
- type Handler
- func (h *Handler) AddTagsToResource(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateCacheCluster(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateCacheParameterGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateCacheSubnetGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateReplicationGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateServerlessCache(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteCacheCluster(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteCacheParameterGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteCacheSubnetGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteReplicationGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteServerlessCache(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeCacheClusters(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeCacheEngineVersions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeCacheParameterGroups(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeCacheParameters(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeCacheSubnetGroups(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeReplicationGroups(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeServerlessCaches(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListTagsForResource(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ModifyCacheCluster(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ModifyReplicationGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ModifyServerlessCache(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RebootCacheCluster(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RemoveTagsFromResource(w http.ResponseWriter, r *http.Request)
- type ReplicationGroup
- type ServerlessCache
- type Service
- func (s *Service) DispatchQuery(w http.ResponseWriter, r *http.Request)
- func (s *Service) InitBus(bus *events.Bus)
- func (s *Service) Name() string
- func (s *Service) Operations() []op.Operation
- func (s *Service) OwnsVersion(version string) bool
- func (s *Service) ReconcileContainers(ctx context.Context, containers []docker.ContainerSummary)
- func (s *Service) RegisterRoutes(_ chi.Router)
- func (s *Service) SetDocker(dc *docker.Client)
- func (s *Service) Stop(ctx context.Context)
- func (s *Service) SupportedProtocols() []codec.Codec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheCluster ¶
type CacheCluster struct {
CacheClusterId string `json:"CacheClusterId"`
CacheClusterStatus string `json:"CacheClusterStatus"`
CacheNodeType string `json:"CacheNodeType"`
Engine string `json:"Engine"`
EngineVersion string `json:"EngineVersion"`
NumCacheNodes int `json:"NumCacheNodes"`
PreferredAvailabilityZone string `json:"PreferredAvailabilityZone,omitempty"`
CacheSubnetGroupName string `json:"CacheSubnetGroupName,omitempty"`
ReplicationGroupId string `json:"ReplicationGroupId,omitempty"`
CacheParameterGroupName string `json:"CacheParameterGroupName,omitempty"`
ARN string `json:"ARN"`
ConfigurationEndpoint *ClusterEndpoint `json:"ConfigurationEndpoint,omitempty"`
// Docker fields — internal only, not returned in API responses.
DockerContainerID string `json:"DockerContainerID,omitempty"`
HostPort int `json:"HostPort,omitempty"`
}
CacheCluster represents a stored ElastiCache cache cluster.
type CacheParameterGroup ¶
type CacheParameterGroup struct {
CacheParameterGroupName string `json:"CacheParameterGroupName"`
CacheParameterGroupFamily string `json:"CacheParameterGroupFamily"`
Description string `json:"Description"`
ARN string `json:"ARN"`
}
CacheParameterGroup represents a stored ElastiCache cache parameter group.
type CacheSubnetGroup ¶
type CacheSubnetGroup struct {
CacheSubnetGroupName string `json:"CacheSubnetGroupName"`
CacheSubnetGroupDescription string `json:"CacheSubnetGroupDescription"`
ARN string `json:"ARN"`
VpcId string `json:"VpcId"`
SubnetIds []string `json:"SubnetIds"`
}
CacheSubnetGroup represents a stored ElastiCache cache subnet group.
type CacheUsageLimits ¶
type CacheUsageLimits struct {
DataStorage DataStorageLimit `json:"DataStorage,omitempty"`
ECPUPerSecond ECPULimit `json:"ECPUPerSecond,omitempty"`
}
type ClusterEndpoint ¶
ClusterEndpoint is the endpoint for a cache cluster or replication group.
type DataStorageLimit ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles ElastiCache Query-protocol requests.
func (*Handler) AddTagsToResource ¶
func (h *Handler) AddTagsToResource(w http.ResponseWriter, r *http.Request)
func (*Handler) CreateCacheCluster ¶
func (h *Handler) CreateCacheCluster(w http.ResponseWriter, r *http.Request)
CreateCacheCluster creates a new cache cluster and (when Docker is available) starts a real Redis container. The cluster transitions to "available" once the TCP health check succeeds, matching AWS semantics.
func (*Handler) CreateCacheParameterGroup ¶
func (h *Handler) CreateCacheParameterGroup(w http.ResponseWriter, r *http.Request)
func (*Handler) CreateCacheSubnetGroup ¶
func (h *Handler) CreateCacheSubnetGroup(w http.ResponseWriter, r *http.Request)
func (*Handler) CreateReplicationGroup ¶
func (h *Handler) CreateReplicationGroup(w http.ResponseWriter, r *http.Request)
CreateReplicationGroup creates a replication group and (when Docker is available) starts a single primary container. The group transitions to "available" once the TCP health check succeeds, matching AWS semantics.
func (*Handler) CreateServerlessCache ¶
func (h *Handler) CreateServerlessCache(w http.ResponseWriter, r *http.Request)
func (*Handler) DeleteCacheCluster ¶
func (h *Handler) DeleteCacheCluster(w http.ResponseWriter, r *http.Request)
func (*Handler) DeleteCacheParameterGroup ¶
func (h *Handler) DeleteCacheParameterGroup(w http.ResponseWriter, r *http.Request)
func (*Handler) DeleteCacheSubnetGroup ¶
func (h *Handler) DeleteCacheSubnetGroup(w http.ResponseWriter, r *http.Request)
func (*Handler) DeleteReplicationGroup ¶
func (h *Handler) DeleteReplicationGroup(w http.ResponseWriter, r *http.Request)
func (*Handler) DeleteServerlessCache ¶
func (h *Handler) DeleteServerlessCache(w http.ResponseWriter, r *http.Request)
func (*Handler) DescribeCacheClusters ¶
func (h *Handler) DescribeCacheClusters(w http.ResponseWriter, r *http.Request)
func (*Handler) DescribeCacheEngineVersions ¶
func (h *Handler) DescribeCacheEngineVersions(w http.ResponseWriter, r *http.Request)
TODO(priority:P3): Implement DescribeCacheEngineVersions — can return a static list of supported redis/valkey versions.
func (*Handler) DescribeCacheParameterGroups ¶
func (h *Handler) DescribeCacheParameterGroups(w http.ResponseWriter, r *http.Request)
func (*Handler) DescribeCacheParameters ¶
func (h *Handler) DescribeCacheParameters(w http.ResponseWriter, r *http.Request)
func (*Handler) DescribeCacheSubnetGroups ¶
func (h *Handler) DescribeCacheSubnetGroups(w http.ResponseWriter, r *http.Request)
func (*Handler) DescribeReplicationGroups ¶
func (h *Handler) DescribeReplicationGroups(w http.ResponseWriter, r *http.Request)
func (*Handler) DescribeServerlessCaches ¶
func (h *Handler) DescribeServerlessCaches(w http.ResponseWriter, r *http.Request)
func (*Handler) ListTagsForResource ¶
func (h *Handler) ListTagsForResource(w http.ResponseWriter, r *http.Request)
func (*Handler) ModifyCacheCluster ¶
func (h *Handler) ModifyCacheCluster(w http.ResponseWriter, r *http.Request)
func (*Handler) ModifyReplicationGroup ¶
func (h *Handler) ModifyReplicationGroup(w http.ResponseWriter, r *http.Request)
func (*Handler) ModifyServerlessCache ¶
func (h *Handler) ModifyServerlessCache(w http.ResponseWriter, r *http.Request)
func (*Handler) RebootCacheCluster ¶
func (h *Handler) RebootCacheCluster(w http.ResponseWriter, r *http.Request)
TODO(priority:P3): Implement RebootCacheCluster.
func (*Handler) RemoveTagsFromResource ¶
func (h *Handler) RemoveTagsFromResource(w http.ResponseWriter, r *http.Request)
type ReplicationGroup ¶
type ReplicationGroup struct {
ReplicationGroupId string `json:"ReplicationGroupId"`
Description string `json:"Description"`
Status string `json:"Status"`
ARN string `json:"ARN"`
AutomaticFailover string `json:"AutomaticFailover"`
MultiAZ string `json:"MultiAZ"`
CacheNodeType string `json:"CacheNodeType"`
Engine string `json:"Engine"`
EngineVersion string `json:"EngineVersion"`
SnapshotRetentionLimit int `json:"SnapshotRetentionLimit"`
MemberClusters []string `json:"MemberClusters,omitempty"`
ConfigurationEndpoint *ClusterEndpoint `json:"ConfigurationEndpoint,omitempty"`
// Docker fields — internal only, not returned in API responses.
DockerContainerID string `json:"DockerContainerID,omitempty"`
HostPort int `json:"HostPort,omitempty"`
}
ReplicationGroup represents a stored ElastiCache replication group.
type ServerlessCache ¶
type ServerlessCache struct {
ServerlessCacheName string `json:"ServerlessCacheName"`
Description string `json:"Description"`
Status string `json:"Status"`
Engine string `json:"Engine"`
MajorEngineVersion string `json:"MajorEngineVersion"`
FullEngineVersion string `json:"FullEngineVersion"`
CacheUsageLimits CacheUsageLimits `json:"CacheUsageLimits,omitempty"`
ARN string `json:"ARN"`
CreateTime string `json:"CreateTime"`
Endpoint *ClusterEndpoint `json:"Endpoint,omitempty"`
ReaderEndpoint *ClusterEndpoint `json:"ReaderEndpoint,omitempty"`
SubnetIds []string `json:"SubnetIds,omitempty"`
SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"`
SnapshotArnsToRestore []string `json:"SnapshotArnsToRestore,omitempty"`
SnapshotRetention int `json:"SnapshotRetentionLimit"`
DailySnapshotTime string `json:"DailySnapshotTime,omitempty"`
NetworkType string `json:"NetworkType,omitempty"`
UserGroupId string `json:"UserGroupId,omitempty"`
KmsKeyId string `json:"KmsKeyId,omitempty"`
DockerContainerID string `json:"DockerContainerID,omitempty"`
HostPort int `json:"HostPort,omitempty"`
}
ServerlessCache represents a stored ElastiCache serverless cache.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements router.Service and router.QueryDispatcher for ElastiCache. Uses the AWS Query protocol (form-encoded POST, XML responses) and identifies itself by the API version "2015-02-02".
func (*Service) DispatchQuery ¶
func (s *Service) DispatchQuery(w http.ResponseWriter, r *http.Request)
DispatchQuery satisfies router.QueryDispatcher; routes to the correct handler.
func (*Service) InitBus ¶
InitBus wires the event bus for ElastiCache lifecycle events and subscribes to Docker container events so cluster status stays in sync with container state.
func (*Service) Operations ¶
func (*Service) OwnsVersion ¶
OwnsVersion satisfies router.QueryVersionOwner.
func (*Service) ReconcileContainers ¶
func (s *Service) ReconcileContainers(ctx context.Context, containers []docker.ContainerSummary)
ReconcileContainers satisfies router.ContainerReconciler. It is called once after Docker becomes available at startup and syncs stored cluster statuses against the actual container state.
func (*Service) RegisterRoutes ¶
RegisterRoutes satisfies router.Service. ElastiCache has no emulator-only REST endpoints; all operations go through DispatchQuery.
func (*Service) SetDocker ¶
SetDocker wires the Docker client for ElastiCache container management and starts the DockerGC background remove loop.
func (*Service) Stop ¶
Stop cancels pending lifecycle transitions, waits for in-flight Docker goroutines, then cleans up all containers via the GC.