elasticache

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 31 Imported by: 0

README

ElastiCache

Parity grade: B · SDK aws-sdk-go-v2/service/elasticache@v1.51.11 · last audited 2026-07-12 (1b31b73f)

Coverage

Metric Value
Operations audited 75 (75 ok)
Feature families 12 (12 ok)
Known gaps 2
Deferred items 2
Resource leaks clean
Known gaps
  • State-transition guards (InvalidCacheClusterStateFault/InvalidReplicationGroupStateFault/InvalidCacheParameterGroupStateFault-for-non-default-groups) are not enforced: Modify/Delete succeed even while a resource's PendingStatus is still creating/modifying/deleting when SetLifecycleDelay > 0. The lifecycle-overlay mechanism (backend_lifecycle.go) tracks the transient state precisely enough to support this, but no mutating op consults it before proceeding. Deliberately NOT implemented this pass: TestLifecycleFullVariantsAreObservable (backend_lifecycle_test.go:395) explicitly asserts that a Modify call immediately after Create (while still "creating") succeeds and reports "modifying" -- adding a guard would flip that test's expected outcome, and the risk of narrowing scope incorrectly (AWS's exact allow/deny matrix per state per op isn't verified) outweighed the value this pass. Left for a follow-up with SDK-parity evidence per transition. (bd: gopherstack-y8l follow-up, not filed as a separate issue this pass -- see Notes)
  • MaxRecords bounds (AWS requires 20-100 for most Describe* ops, InvalidParameterValueException otherwise) are accepted verbatim without range validation across all paginated ops. Shared pattern likely present in most query-protocol services in this repo, not elasticache-specific; deferred as a cross-service concern rather than a targeted elasticache fix.
Deferred
  • Full data-plane snapshot/restore fidelity (actual key-value RDB dump/reload through miniredis) -- CreateCacheCluster/CreateReplicationGroup SnapshotName now validates existence and inherits engine/node-type metadata (the real API-contract behavior verified against api-2.json), but does not replay the source's actual key data into the restored miniredis instance. Flagged as a possible future enhancement, not a wire-shape/error-code bug.
  • Quota-exceeded faults (ClusterQuotaForCustomerExceededFault, NodeQuotaForClusterExceededFault, CacheParameterGroupQuotaExceededFault, etc.) are not modeled -- no artificial resource limits are enforced. Standard for an emulator; not audited further this pass.

More

Documentation

Index

Constants

View Source
const (
	EngineEmbedded = "embedded"
	EngineDocker   = "docker"
	EngineStub     = "stub"
)

Engine mode constants.

Variables

View Source
var (
	ErrClusterNotFound                    = errors.New("CacheClusterNotFound")
	ErrClusterAlreadyExists               = errors.New("CacheClusterAlreadyExists")
	ErrReplicationGroupNotFound           = errors.New("ReplicationGroupNotFound")
	ErrReplicationGroupAlreadyExists      = errors.New("ReplicationGroupAlreadyExists")
	ErrResourceNotFound                   = errors.New("resource not found")
	ErrParameterGroupNotFound             = errors.New("CacheParameterGroupNotFound")
	ErrParameterGroupAlreadyExists        = errors.New("CacheParameterGroupAlreadyExists")
	ErrParameterGroupDefaultNotModifiable = errors.New("default parameter group cannot be deleted or modified")
	ErrInvalidParameterGroupFamily        = errors.New("InvalidParameterGroupFamily")
	ErrSubnetGroupNotFound                = errors.New("CacheSubnetGroupNotFound")
	ErrSubnetGroupAlreadyExists           = errors.New("CacheSubnetGroupAlreadyExists")
	ErrSnapshotNotFound                   = errors.New("SnapshotNotFound")
	ErrSnapshotAlreadyExists              = errors.New("SnapshotAlreadyExistsFault")
	ErrInvalidSnapshotSource              = errors.New(
		"exactly one of CacheClusterId or ReplicationGroupId must be specified",
	)
)
View Source
var (
	ErrClusterModeRequired          = errors.New("cluster mode must be enabled for shard configuration changes")
	ErrDataTieringInvalid           = errors.New("data tiering requires r7g node type and Redis/Valkey 7.0+")
	ErrTransitEncryptionModeInvalid = errors.New("transit encryption mode 'required' requires an auth token")
	ErrAuthTokenRequiredForMode     = errors.New(
		"auth token must be provided when transit encryption mode is 'required'",
	)
)
View Source
var (
	ErrUserGroupNotFound                  = errors.New("UserGroupNotFound")
	ErrUserGroupAlreadyExists             = errors.New("UserGroupAlreadyExistsFault")
	ErrReservedCacheNodeNotFound          = errors.New("ReservedCacheNodeNotFound")
	ErrReservedCacheNodeAlreadyExists     = errors.New("ReservedCacheNodeAlreadyExists")
	ErrReservedCacheNodesOfferingNotFound = errors.New("ReservedCacheNodesOfferingNotFound")
)
View Source
var (
	ErrUserNotInGroup    = errors.New("user is a member of a user group and cannot be deleted")
	ErrUserNotFound2     = ErrUserNotFound
	ErrGroupUserNotFound = errors.New("one or more specified user IDs do not exist")
)
View Source
var (
	ErrCacheSecurityGroupNotFound      = errors.New("CacheSecurityGroupNotFound")
	ErrCacheSecurityGroupAlreadyExists = errors.New("CacheSecurityGroupAlreadyExists")
	ErrGlobalReplicationGroupNotFound  = errors.New("GlobalReplicationGroupNotFound")
	ErrGlobalReplicationGroupExists    = errors.New("GlobalReplicationGroupAlreadyExistsFault")
	ErrServerlessCacheNotFound         = errors.New("ServerlessCacheNotFound")
	ErrServerlessCacheAlreadyExists    = errors.New("ServerlessCacheAlreadyExistsFault")
	ErrServerlessCacheSnapshotNotFound = errors.New("ServerlessCacheSnapshotNotFoundFault")
	ErrServerlessCacheSnapshotExists   = errors.New("ServerlessCacheSnapshotAlreadyExistsFault")
	ErrUserNotFound                    = errors.New("UserNotFound")
	ErrUserAlreadyExists               = errors.New("UserAlreadyExists")
)
View Source
var ErrNilContext = errors.New("nil context")

Functions

This section is empty.

Types

type BatchUpdateResult

type BatchUpdateResult struct {
	ProcessedUpdateActions   []UpdateActionResult `json:"processedUpdateActions"`
	UnprocessedUpdateActions []UpdateActionResult `json:"unprocessedUpdateActions"`
}

BatchUpdateResult holds the results of a BatchApplyUpdateAction / BatchStopUpdateAction call.

type CacheEngineVersion

type CacheEngineVersion struct {
	Engine                        string
	EngineVersion                 string
	CacheParameterGroupFamily     string
	CacheEngineDescription        string
	CacheEngineVersionDescription string
}

CacheEngineVersion represents an engine version.

type CacheEvent

type CacheEvent struct {
	Date             time.Time `json:"date"`
	SourceIdentifier string    `json:"sourceIdentifier"`
	SourceType       string    `json:"sourceType"`
	Message          string    `json:"message"`
}

CacheEvent represents a recorded ElastiCache operation event.

type CacheNodeMember

type CacheNodeMember struct {
	CacheClusterID            string    `json:"cacheClusterId"`
	CacheNodeID               string    `json:"cacheNodeId"`
	CacheNodeStatus           string    `json:"cacheNodeStatus"`
	PreferredAvailabilityZone string    `json:"preferredAvailabilityZone"`
	CacheNodeCreateTime       time.Time `json:"cacheNodeCreateTime"`
	Endpoint                  struct {
		Address string `json:"address"`
		Port    int    `json:"port"`
	} `json:"endpoint"`
}

CacheNodeMember represents a Memcached cluster node member (gap #3).

type CacheParameter

type CacheParameter struct {
	Name          string
	Value         string
	Description   string
	DataType      string
	AllowedValues string
	IsModifiable  bool
}

CacheParameter represents a single cache parameter (for DescribeParameters response).

type CacheParameterGroup

type CacheParameterGroup struct {
	Tags        *tags.Tags        `json:"tags,omitempty"`
	Parameters  map[string]string `json:"parameters"`
	Name        string            `json:"name"`
	Family      string            `json:"family"`
	Description string            `json:"description"`
	ARN         string            `json:"arn"`
	IsGlobal    bool              `json:"isGlobal"`
}

CacheParameterGroup represents an ElastiCache parameter group.

type CacheSecurityGroup

type CacheSecurityGroup struct {
	Tags        *tags.Tags `json:"tags,omitempty"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	ARN         string     `json:"arn"`
	OwnerID     string     `json:"ownerId"`
}

CacheSecurityGroup represents an ElastiCache cache security group (EC2-Classic).

type CacheSnapshot

type CacheSnapshot struct {
	CreatedAt          time.Time  `json:"createdAt"`
	AvailableAt        time.Time  `json:"availableAt,omitzero"`
	Tags               *tags.Tags `json:"tags,omitempty"`
	SnapshotName       string     `json:"snapshotName"`
	CacheClusterID     string     `json:"cacheClusterId"`
	ReplicationGroupID string     `json:"replicationGroupId"`
	Status             string     `json:"status"`
	PendingStatus      string     `json:"pendingStatus,omitempty"`
	ARN                string     `json:"arn"`
	Engine             string     `json:"engine"`
	EngineVersion      string     `json:"engineVersion"`
	NodeType           string     `json:"nodeType"`
	KmsKeyID           string     `json:"kmsKeyId,omitempty"`
	SnapshotSource     string     `json:"snapshotSource"` // "manual" or "automated"
}

CacheSnapshot represents an ElastiCache snapshot.

type CacheSubnetGroup

type CacheSubnetGroup struct {
	Tags        *tags.Tags `json:"tags,omitempty"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	VpcID       string     `json:"vpcId"`
	ARN         string     `json:"arn"`
	SubnetIDs   []string   `json:"subnetIds"`
}

CacheSubnetGroup represents an ElastiCache subnet group.

type Cluster

type Cluster struct {
	CreatedAt time.Time
	Tags      *tags.Tags

	ClusterID                  string
	Engine                     string
	EngineVersion              string
	Status                     string
	Endpoint                   string
	NodeType                   string
	ARN                        string
	Region                     string
	CacheParameterGroupName    string
	PreferredMaintenanceWindow string
	SnapshotWindow             string
	ReplicationGroupID         string
	KmsKeyID                   string
	TransitEncryptionMode      string
	ConnectAddress             string
	PendingStatus              string
	AvailableAt                time.Time
	Members                    []CacheNodeMember
	Port                       int
	AllocatedPort              int
	NumCacheNodes              int
	TransitEncryptionEnabled   bool
	AtRestEncryptionEnabled    bool
	// contains filtered or unexported fields
}

Cluster represents an ElastiCache cluster.

type DNSRegistrar

type DNSRegistrar interface {
	Register(hostname string)
	Deregister(hostname string)
}

DNSRegistrar can register and deregister hostnames with an embedded DNS server.

type EC2SecurityGroupMembership

type EC2SecurityGroupMembership struct {
	EC2SecurityGroupName    string `json:"ec2SecurityGroupName"`
	EC2SecurityGroupOwnerID string `json:"ec2SecurityGroupOwnerId"`
	Status                  string `json:"status"`
}

EC2SecurityGroupMembership is a single EC2 security group authorization on a cache security group.

type EngineConfig

type EngineConfig interface {
	GetElastiCacheEngine() string
}

EngineConfig is the interface for accessing the ElastiCache engine mode configuration (embedded, stub, or docker).

type GlobalReplicationGroup

type GlobalReplicationGroup struct {
	CreatedAt                     time.Time         `json:"createdAt"`
	AvailableAt                   time.Time         `json:"availableAt,omitzero"`
	Tags                          *tags.Tags        `json:"tags,omitempty"`
	SecondaryReplicationGroups    map[string]string `json:"secondaryReplicationGroups,omitempty"`
	GlobalReplicationGroupID      string            `json:"globalReplicationGroupId"`
	Description                   string            `json:"description"`
	Status                        string            `json:"status"`
	PendingStatus                 string            `json:"pendingStatus,omitempty"`
	ARN                           string            `json:"arn"`
	Engine                        string            `json:"engine"`
	EngineVersion                 string            `json:"engineVersion"`
	PrimaryReplicationGroupRegion string            `json:"primaryReplicationGroupRegion,omitempty"`
	NodeGroupCount                int32             `json:"nodeGroupCount,omitempty"`
}

GlobalReplicationGroup represents an ElastiCache global replication group.

type Handler

type Handler struct {
	Backend   StorageBackend
	AccountID string
	Region    string
}

Handler is the Echo HTTP handler for ElastiCache operations.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a new ElastiCache handler.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this ElastiCache instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the Action from the form body.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts the primary resource identifier from the request.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns all supported ElastiCache operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for ElastiCache requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all backend state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a matcher for ElastiCache query-protocol requests.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

type InMemoryBackend

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

InMemoryBackend is an in-memory ElastiCache backend. All regional resource maps are nested by region (outer key = region) so that same-named resources in different regions are fully isolated. GlobalReplicationGroups are global/partition-scoped (like AWS) and therefore are NOT region-nested.

func NewInMemoryBackend

func NewInMemoryBackend(engineMode, accountID, region string, allocator *portalloc.Allocator) *InMemoryBackend

NewInMemoryBackend creates a new backend with the given engine mode.

func (*InMemoryBackend) AddCacheSecurityGroupInternal

func (b *InMemoryBackend) AddCacheSecurityGroupInternal(sg *CacheSecurityGroup)

AddCacheSecurityGroupInternal seeds a cache security group for testing.

func (*InMemoryBackend) AddGlobalReplicationGroupInternal

func (b *InMemoryBackend) AddGlobalReplicationGroupInternal(grg *GlobalReplicationGroup)

AddGlobalReplicationGroupInternal seeds a global replication group for testing.

func (*InMemoryBackend) AddServerlessCacheInternal

func (b *InMemoryBackend) AddServerlessCacheInternal(sc *ServerlessCache)

AddServerlessCacheInternal seeds a serverless cache for testing.

func (*InMemoryBackend) AddServerlessCacheSnapshotInternal

func (b *InMemoryBackend) AddServerlessCacheSnapshotInternal(snap *ServerlessCacheSnapshot)

AddServerlessCacheSnapshotInternal seeds a serverless cache snapshot for testing.

func (*InMemoryBackend) AddTagsToResource

func (b *InMemoryBackend) AddTagsToResource(_ context.Context, resourceARN string, newTags map[string]string) error

AddTagsToResource adds or updates tags on the resource identified by resourceARN.

func (*InMemoryBackend) AddUserGroupInternal

func (b *InMemoryBackend) AddUserGroupInternal(ug *UserGroup)

AddUserGroupInternal seeds a user group for testing.

func (*InMemoryBackend) AddUserInternal

func (b *InMemoryBackend) AddUserInternal(u *User)

AddUserInternal seeds a user for testing.

func (*InMemoryBackend) AppendUpdateActions

func (b *InMemoryBackend) AppendUpdateActions(actions []*UpdateAction)

AppendUpdateActions appends new update action records.

func (*InMemoryBackend) AuthorizeCacheSecurityGroupIngress

func (b *InMemoryBackend) AuthorizeCacheSecurityGroupIngress(
	ctx context.Context,
	name, ec2SecurityGroupName, ec2SecurityGroupOwnerID string,
) (*CacheSecurityGroup, error)

AuthorizeCacheSecurityGroupIngress adds an EC2 security group authorization to the named cache security group.

func (*InMemoryBackend) BatchApplyUpdateAction

func (b *InMemoryBackend) BatchApplyUpdateAction(
	_ context.Context,
	replicationGroupIDs, cacheClusterIDs []string,
	serviceUpdateName string,
) (*BatchUpdateResult, error)

BatchApplyUpdateAction schedules a service update for the given replication groups and clusters.

func (*InMemoryBackend) BatchStopUpdateAction

func (b *InMemoryBackend) BatchStopUpdateAction(
	_ context.Context,
	replicationGroupIDs, cacheClusterIDs []string,
	serviceUpdateName string,
) (*BatchUpdateResult, error)

BatchStopUpdateAction stops a pending service update for the given replication groups and clusters.

func (*InMemoryBackend) CompleteMigration

func (b *InMemoryBackend) CompleteMigration(
	ctx context.Context,
	replicationGroupID string,
	_ bool,
) (*ReplicationGroup, error)

CompleteMigration completes an online data migration from an external Redis server to this replication group.

func (*InMemoryBackend) CopyServerlessCacheSnapshot

func (b *InMemoryBackend) CopyServerlessCacheSnapshot(
	ctx context.Context,
	sourceSnapshotName, targetSnapshotName string,
) (*ServerlessCacheSnapshot, error)

CopyServerlessCacheSnapshot copies a serverless cache snapshot to a new name.

func (*InMemoryBackend) CopySnapshot

func (b *InMemoryBackend) CopySnapshot(
	ctx context.Context,
	sourceSnapshotName, targetSnapshotName string,
) (*CacheSnapshot, error)

CopySnapshot copies an existing snapshot to a new name.

func (*InMemoryBackend) CopySnapshotFull

func (b *InMemoryBackend) CopySnapshotFull(
	ctx context.Context,
	sourceSnapshotName, targetSnapshotName, kmsKeyID string,
) (*CacheSnapshot, error)

CopySnapshotFull copies a snapshot and optionally re-encrypts with a different KMS key.

func (*InMemoryBackend) CreateCacheSecurityGroup

func (b *InMemoryBackend) CreateCacheSecurityGroup(
	ctx context.Context,
	name, description string,
) (*CacheSecurityGroup, error)

CreateCacheSecurityGroup creates a new cache security group.

func (*InMemoryBackend) CreateCluster

func (b *InMemoryBackend) CreateCluster(ctx context.Context, id, engine, nodeType string, port int) (*Cluster, error)

CreateCluster creates a new cache cluster.

func (*InMemoryBackend) CreateClusterWithOptions

func (b *InMemoryBackend) CreateClusterWithOptions(
	ctx context.Context,
	id, engine, nodeType, paramGroupName, maintenanceWindow, snapshotWindow string,
	numCacheNodes, port int,
) (*Cluster, error)

CreateClusterWithOptions creates a new cache cluster with optional parameter group and scheduling windows.

func (*InMemoryBackend) CreateGlobalReplicationGroup

func (b *InMemoryBackend) CreateGlobalReplicationGroup(
	ctx context.Context,
	globalReplicationGroupIDSuffix, description, primaryReplicationGroupID string,
) (*GlobalReplicationGroup, error)

CreateGlobalReplicationGroup creates a new global replication group.

func (*InMemoryBackend) CreateParameterGroup

func (b *InMemoryBackend) CreateParameterGroup(
	ctx context.Context,
	name, family, description string,
) (*CacheParameterGroup, error)

CreateParameterGroup creates a new cache parameter group.

func (*InMemoryBackend) CreateReplicationGroup

func (b *InMemoryBackend) CreateReplicationGroup(
	ctx context.Context,
	id, description string,
) (*ReplicationGroup, error)

CreateReplicationGroup creates a replication group.

func (*InMemoryBackend) CreateReplicationGroupFull

func (b *InMemoryBackend) CreateReplicationGroupFull(
	ctx context.Context,
	opts ReplicationGroupCreateOpts,
) (*ReplicationGroup, error)

CreateReplicationGroupFull creates a replication group with the full set of options.

func (*InMemoryBackend) CreateReplicationGroupWithOptions

func (b *InMemoryBackend) CreateReplicationGroupWithOptions(
	ctx context.Context,
	id, description, paramGroupName, maintenanceWindow, snapshotWindow string,
) (*ReplicationGroup, error)

CreateReplicationGroupWithOptions creates a replication group with optional parameter group and scheduling windows.

func (*InMemoryBackend) CreateServerlessCache

func (b *InMemoryBackend) CreateServerlessCache(
	ctx context.Context,
	name, description, engine string,
) (*ServerlessCache, error)

CreateServerlessCache creates a new serverless cache.

func (*InMemoryBackend) CreateServerlessCacheFull

func (b *InMemoryBackend) CreateServerlessCacheFull(
	ctx context.Context,
	opts ServerlessCreateOpts,
) (*ServerlessCache, error)

CreateServerlessCacheFull creates a serverless cache with the full set of options.

func (*InMemoryBackend) CreateServerlessCacheSnapshot

func (b *InMemoryBackend) CreateServerlessCacheSnapshot(
	ctx context.Context,
	snapshotName, serverlessCacheName string,
) (*ServerlessCacheSnapshot, error)

CreateServerlessCacheSnapshot creates a manual snapshot of a serverless cache.

func (*InMemoryBackend) CreateSnapshot

func (b *InMemoryBackend) CreateSnapshot(
	ctx context.Context,
	snapshotName, clusterID, replicationGroupID string,
) (*CacheSnapshot, error)

CreateSnapshot creates a manual snapshot of a cluster or replication group.

func (*InMemoryBackend) CreateSubnetGroup

func (b *InMemoryBackend) CreateSubnetGroup(
	ctx context.Context,
	name, description string,
	subnetIDs []string,
) (*CacheSubnetGroup, error)

CreateSubnetGroup creates a new cache subnet group.

func (*InMemoryBackend) CreateSubnetGroupFull

func (b *InMemoryBackend) CreateSubnetGroupFull(
	ctx context.Context,
	name, description, vpcID string,
	subnetIDs []string,
) (*CacheSubnetGroup, error)

CreateSubnetGroupFull creates a cache subnet group with an explicit VPC ID.

func (*InMemoryBackend) CreateUser

func (b *InMemoryBackend) CreateUser(
	ctx context.Context,
	userID, userName, accessString, engine string,
	noPasswordRequired bool,
) (*User, error)

CreateUser creates a new ElastiCache user.

func (*InMemoryBackend) CreateUserGroup

func (b *InMemoryBackend) CreateUserGroup(
	ctx context.Context,
	groupID, description, engine string,
	userIDs []string,
) (*UserGroup, error)

CreateUserGroup creates a new user group.

func (*InMemoryBackend) CreateUserGroupValidated

func (b *InMemoryBackend) CreateUserGroupValidated(
	ctx context.Context,
	groupID, description, engine string,
	userIDs []string,
) (*UserGroup, error)

CreateUserGroupValidated creates a user group, validating that all specified user IDs exist.

func (*InMemoryBackend) DecreaseNodeGroupsInGlobalReplicationGroup

func (b *InMemoryBackend) DecreaseNodeGroupsInGlobalReplicationGroup(
	_ context.Context,
	id string,
	nodeGroupCount int32,
) (*GlobalReplicationGroup, error)

DecreaseNodeGroupsInGlobalReplicationGroup decreases the node group count.

func (*InMemoryBackend) DecreaseReplicaCount

func (b *InMemoryBackend) DecreaseReplicaCount(
	ctx context.Context,
	replicationGroupID string,
	newReplicaCount int32,
) (*ReplicationGroup, error)

DecreaseReplicaCount decreases the replica count for a replication group.

func (*InMemoryBackend) DeleteCacheSecurityGroup

func (b *InMemoryBackend) DeleteCacheSecurityGroup(ctx context.Context, name string) error

DeleteCacheSecurityGroup deletes a cache security group.

func (*InMemoryBackend) DeleteCluster

func (b *InMemoryBackend) DeleteCluster(ctx context.Context, id string) error

DeleteCluster stops and removes a cluster.

func (*InMemoryBackend) DeleteGlobalReplicationGroup

func (b *InMemoryBackend) DeleteGlobalReplicationGroup(
	_ context.Context,
	id string,
	_ bool,
) (*GlobalReplicationGroup, error)

DeleteGlobalReplicationGroup deletes a global replication group.

func (*InMemoryBackend) DeleteParameterGroup

func (b *InMemoryBackend) DeleteParameterGroup(ctx context.Context, name string) error

DeleteParameterGroup removes a cache parameter group.

func (*InMemoryBackend) DeleteReplicationGroup

func (b *InMemoryBackend) DeleteReplicationGroup(ctx context.Context, id string) error

DeleteReplicationGroup removes a replication group.

func (*InMemoryBackend) DeleteServerlessCache

func (b *InMemoryBackend) DeleteServerlessCache(ctx context.Context, name string) (*ServerlessCache, error)

DeleteServerlessCache deletes a serverless cache.

func (*InMemoryBackend) DeleteServerlessCacheSnapshot

func (b *InMemoryBackend) DeleteServerlessCacheSnapshot(
	ctx context.Context,
	name string,
) (*ServerlessCacheSnapshot, error)

DeleteServerlessCacheSnapshot deletes a serverless cache snapshot.

func (*InMemoryBackend) DeleteSnapshot

func (b *InMemoryBackend) DeleteSnapshot(ctx context.Context, snapshotName string) (*CacheSnapshot, error)

DeleteSnapshot removes a snapshot and returns the deleted snapshot.

func (*InMemoryBackend) DeleteSubnetGroup

func (b *InMemoryBackend) DeleteSubnetGroup(ctx context.Context, name string) error

DeleteSubnetGroup removes a cache subnet group.

func (*InMemoryBackend) DeleteUser

func (b *InMemoryBackend) DeleteUser(ctx context.Context, userID string) (*User, error)

DeleteUser deletes a user by ID.

func (*InMemoryBackend) DeleteUserGroup

func (b *InMemoryBackend) DeleteUserGroup(ctx context.Context, groupID string) (*UserGroup, error)

DeleteUserGroup deletes a user group by ID.

func (*InMemoryBackend) DeleteUserSafe

func (b *InMemoryBackend) DeleteUserSafe(ctx context.Context, userID string) (*User, error)

DeleteUserSafe deletes a user, but returns an error if the user is still a member of any user group.

func (*InMemoryBackend) DescribeCacheEngineVersions

func (b *InMemoryBackend) DescribeCacheEngineVersions(
	_ context.Context,
	engine, family, engineVersion, marker string,
	maxRecords int,
) (page.Page[CacheEngineVersion], error)

DescribeCacheEngineVersions returns engine versions, optionally filtered.

func (*InMemoryBackend) DescribeCacheSecurityGroups

func (b *InMemoryBackend) DescribeCacheSecurityGroups(
	ctx context.Context,
	name, marker string,
	maxRecords int,
) (page.Page[CacheSecurityGroup], error)

DescribeCacheSecurityGroups returns a paginated list of cache security groups.

func (*InMemoryBackend) DescribeClusters

func (b *InMemoryBackend) DescribeClusters(
	ctx context.Context,
	id, marker string,
	maxRecords int,
	notInRG bool,
) (page.Page[Cluster], error)

DescribeClusters returns one cluster by id, or a paginated list of all clusters when id is empty. When notInRG is true, only clusters with no ReplicationGroupID are returned (standalone clusters).

func (*InMemoryBackend) DescribeEngineDefaultParameters

func (b *InMemoryBackend) DescribeEngineDefaultParameters(
	_ context.Context,
	cacheParameterGroupFamily string,
	marker string,
	maxRecords int,
) (page.Page[CacheParameter], error)

DescribeEngineDefaultParameters returns the default parameters for a parameter group family.

func (*InMemoryBackend) DescribeEvents

func (b *InMemoryBackend) DescribeEvents(
	_ context.Context,
	sourceIdentifier, sourceType, marker string,
	startTime, endTime time.Time,
	duration, maxRecords int,
) (page.Page[CacheEvent], error)

DescribeEvents returns a paginated list of recorded events, optionally filtered by source and time.

func (*InMemoryBackend) DescribeGlobalReplicationGroups

func (b *InMemoryBackend) DescribeGlobalReplicationGroups(
	_ context.Context,
	id, marker string,
	maxRecords int,
) (page.Page[GlobalReplicationGroup], error)

DescribeGlobalReplicationGroups returns a paginated list of global replication groups.

func (*InMemoryBackend) DescribeParameterGroups

func (b *InMemoryBackend) DescribeParameterGroups(
	ctx context.Context,
	name, marker string,
	maxRecords int,
) (page.Page[CacheParameterGroup], error)

DescribeParameterGroups returns one parameter group by name, or a paginated list of all.

func (*InMemoryBackend) DescribeParameters

func (b *InMemoryBackend) DescribeParameters(
	ctx context.Context,
	name, marker string,
	maxRecords int,
) (page.Page[CacheParameter], error)

DescribeParameters lists parameters in a cache parameter group.

func (*InMemoryBackend) DescribeReplicationGroups

func (b *InMemoryBackend) DescribeReplicationGroups(
	ctx context.Context,
	id, marker string,
	maxRecords int,
) (page.Page[ReplicationGroup], error)

DescribeReplicationGroups returns one replication group by id, or a paginated list of all when id is empty.

func (*InMemoryBackend) DescribeReservedCacheNodes

func (b *InMemoryBackend) DescribeReservedCacheNodes(
	ctx context.Context,
	id, cacheNodeType, offeringType, marker string,
	maxRecords int,
) (page.Page[ReservedCacheNode], error)

DescribeReservedCacheNodes returns a paginated list of reserved cache nodes.

func (*InMemoryBackend) DescribeReservedCacheNodesOfferings

func (b *InMemoryBackend) DescribeReservedCacheNodesOfferings(
	_ context.Context,
	offeringID, cacheNodeType, offeringType, marker string,
	maxRecords int,
) (page.Page[ReservedCacheNodesOffering], error)

DescribeReservedCacheNodesOfferings returns a paginated list of reserved cache node offerings.

func (*InMemoryBackend) DescribeServerlessCacheSnapshots

func (b *InMemoryBackend) DescribeServerlessCacheSnapshots(
	ctx context.Context,
	serverlessCacheName, snapshotName, marker string,
	maxRecords int,
) (page.Page[ServerlessCacheSnapshot], error)

DescribeServerlessCacheSnapshots returns a paginated list of serverless cache snapshots.

func (*InMemoryBackend) DescribeServerlessCaches

func (b *InMemoryBackend) DescribeServerlessCaches(
	ctx context.Context,
	name, marker string,
	maxRecords int,
) (page.Page[ServerlessCache], error)

DescribeServerlessCaches returns a paginated list of serverless caches.

func (*InMemoryBackend) DescribeServiceUpdates

func (b *InMemoryBackend) DescribeServiceUpdates(
	_ context.Context,
	serviceUpdateName string,
	marker string,
	maxRecords int,
	status []string,
) (page.Page[ServiceUpdate], error)

DescribeServiceUpdates returns service updates, filtered by name and status.

func (*InMemoryBackend) DescribeServiceUpdatesFull

func (b *InMemoryBackend) DescribeServiceUpdatesFull(
	serviceUpdateName string,
	status []string,
	marker string,
	maxRecords int,
) ([]ServiceUpdate, string, error)

DescribeServiceUpdatesFull returns service updates, filtered by name and/or status list.

func (*InMemoryBackend) DescribeSnapshots

func (b *InMemoryBackend) DescribeSnapshots(
	ctx context.Context,
	snapshotName, clusterID, replicationGroupID, snapshotSource, marker string,
	maxRecords int,
) (page.Page[CacheSnapshot], error)

DescribeSnapshots returns one snapshot by name, or a paginated list filtered by cluster/rg/source. snapshotSource mirrors the real AWS filter values: "system" matches automated snapshots, "user" matches manual snapshots, and "" returns all.

func (*InMemoryBackend) DescribeSubnetGroups

func (b *InMemoryBackend) DescribeSubnetGroups(
	ctx context.Context,
	name, marker string,
	maxRecords int,
) (page.Page[CacheSubnetGroup], error)

DescribeSubnetGroups returns one subnet group by name, or a paginated list of all.

func (*InMemoryBackend) DescribeUpdateActions

func (b *InMemoryBackend) DescribeUpdateActions(
	_ context.Context,
	serviceUpdateName string,
	marker string,
	maxRecords int,
) (page.Page[UpdateAction], error)

DescribeUpdateActions returns update actions, filtered by service update name.

func (*InMemoryBackend) DescribeUpdateActionsFull

func (b *InMemoryBackend) DescribeUpdateActionsFull(
	serviceUpdateName, marker string,
	maxRecords int,
) ([]UpdateAction, string, error)

DescribeUpdateActionsFull returns update actions filtered by service update name, with pagination.

func (*InMemoryBackend) DescribeUserGroups

func (b *InMemoryBackend) DescribeUserGroups(
	ctx context.Context,
	groupID, marker string,
	maxRecords int,
) (page.Page[UserGroup], error)

DescribeUserGroups returns a paginated list of user groups, optionally filtered by groupID.

func (*InMemoryBackend) DescribeUsers

func (b *InMemoryBackend) DescribeUsers(
	ctx context.Context,
	userID, marker string,
	maxRecords int,
) (page.Page[User], error)

DescribeUsers returns a paginated list of users, optionally filtered by userID.

func (*InMemoryBackend) DisassociateGlobalReplicationGroup

func (b *InMemoryBackend) DisassociateGlobalReplicationGroup(
	_ context.Context,
	id, _, _ string,
) (*GlobalReplicationGroup, error)

DisassociateGlobalReplicationGroup removes a secondary replication group from a global replication group.

func (*InMemoryBackend) ExportServerlessCacheSnapshot

func (b *InMemoryBackend) ExportServerlessCacheSnapshot(
	ctx context.Context,
	snapshotName, _ string,
) (*ServerlessCacheSnapshot, error)

ExportServerlessCacheSnapshot exports a serverless cache snapshot to S3.

func (*InMemoryBackend) FailoverGlobalReplicationGroup

func (b *InMemoryBackend) FailoverGlobalReplicationGroup(
	_ context.Context,
	id, _, _ string,
) (*GlobalReplicationGroup, error)

FailoverGlobalReplicationGroup promotes a secondary region to primary.

func (*InMemoryBackend) FailoverReplicationGroup

func (b *InMemoryBackend) FailoverReplicationGroup(ctx context.Context, id, _ string) (*ReplicationGroup, error)

FailoverReplicationGroup simulates a failover for the given replication group.

func (*InMemoryBackend) IncreaseNodeGroupsInGlobalReplicationGroup

func (b *InMemoryBackend) IncreaseNodeGroupsInGlobalReplicationGroup(
	_ context.Context,
	id string,
	nodeGroupCount int32,
) (*GlobalReplicationGroup, error)

IncreaseNodeGroupsInGlobalReplicationGroup increases the node group count.

func (*InMemoryBackend) IncreaseReplicaCount

func (b *InMemoryBackend) IncreaseReplicaCount(
	ctx context.Context,
	replicationGroupID string,
	newReplicaCount int32,
) (*ReplicationGroup, error)

IncreaseReplicaCount increases the replica count for a replication group.

func (*InMemoryBackend) ListAll

func (b *InMemoryBackend) ListAll() []Cluster

ListAll returns all clusters across all regions (used by dashboard).

func (*InMemoryBackend) ListAllowedNodeTypeModifications

func (b *InMemoryBackend) ListAllowedNodeTypeModifications(_ context.Context, _, _ string) ([]string, error)

ListAllowedNodeTypeModifications returns a list of allowed node type modifications.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(_ context.Context, arn string) (map[string]string, error)

ListTagsForResource returns tags for the given ARN.

func (*InMemoryBackend) ListUpdateActionsByServiceUpdate

func (b *InMemoryBackend) ListUpdateActionsByServiceUpdate(serviceUpdateName string) []*UpdateAction

ListUpdateActionsByServiceUpdate returns update actions filtered by service update name.

func (*InMemoryBackend) ModifyCluster

func (b *InMemoryBackend) ModifyCluster(
	ctx context.Context,
	id, nodeType, paramGroupName, engineVersion, maintenanceWindow, snapshotWindow string,
	numCacheNodes int,
) (*Cluster, error)

ModifyCluster modifies an existing cache cluster.

func (*InMemoryBackend) ModifyGlobalReplicationGroup

func (b *InMemoryBackend) ModifyGlobalReplicationGroup(
	_ context.Context,
	id, description, engineVersion string,
	automaticFailoverEnabled bool,
) (*GlobalReplicationGroup, error)

ModifyGlobalReplicationGroup modifies a global replication group.

func (*InMemoryBackend) ModifyParameterGroup

func (b *InMemoryBackend) ModifyParameterGroup(
	ctx context.Context,
	name string,
	params map[string]string,
) (*CacheParameterGroup, error)

ModifyParameterGroup updates parameters in a cache parameter group.

func (*InMemoryBackend) ModifyReplicationGroup

func (b *InMemoryBackend) ModifyReplicationGroup(
	ctx context.Context,
	id, description, paramGroupName, engineVersion, cacheNodeType, maintenanceWindow, snapshotWindow string,
	automaticFailoverEnabled, multiAZEnabled *bool,
) (*ReplicationGroup, error)

ModifyReplicationGroup modifies an existing replication group.

func (*InMemoryBackend) ModifyReplicationGroupFull

func (b *InMemoryBackend) ModifyReplicationGroupFull(
	ctx context.Context,
	id string,
	opts ReplicationGroupModifyOpts,
) (*ReplicationGroup, error)

ModifyReplicationGroupFull modifies a replication group with the full set of options.

func (*InMemoryBackend) ModifyReplicationGroupShardConfiguration

func (b *InMemoryBackend) ModifyReplicationGroupShardConfiguration(
	ctx context.Context,
	replicationGroupID string,
	nodeGroupCount int32,
) (*ReplicationGroup, error)

ModifyReplicationGroupShardConfiguration modifies the shard configuration of a replication group. Cluster mode must be enabled to use this operation.

func (*InMemoryBackend) ModifyServerlessCache

func (b *InMemoryBackend) ModifyServerlessCache(
	ctx context.Context,
	name, description string,
) (*ServerlessCache, error)

ModifyServerlessCache modifies a serverless cache.

func (*InMemoryBackend) ModifyServerlessCacheFull

func (b *InMemoryBackend) ModifyServerlessCacheFull(
	ctx context.Context,
	name string,
	opts ServerlessModifyOpts,
) (*ServerlessCache, error)

ModifyServerlessCacheFull modifies a serverless cache with the full set of options.

func (*InMemoryBackend) ModifySubnetGroup

func (b *InMemoryBackend) ModifySubnetGroup(
	ctx context.Context,
	name, description string,
	subnetIDs []string,
) (*CacheSubnetGroup, error)

ModifySubnetGroup updates a cache subnet group.

func (*InMemoryBackend) ModifyUser

func (b *InMemoryBackend) ModifyUser(
	ctx context.Context,
	userID, accessString string,
	noPasswordRequired bool,
) (*User, error)

ModifyUser modifies a user's access string and/or password settings.

func (*InMemoryBackend) ModifyUserGroup

func (b *InMemoryBackend) ModifyUserGroup(
	ctx context.Context,
	groupID string,
	userIDsToAdd, userIDsToRemove []string,
) (*UserGroup, error)

ModifyUserGroup adds or removes users from a user group.

func (*InMemoryBackend) PurchaseReservedCacheNodesOffering

func (b *InMemoryBackend) PurchaseReservedCacheNodesOffering(
	ctx context.Context,
	offeringID, reservedCacheNodeID string,
	cacheNodeCount int32,
) (*ReservedCacheNode, error)

PurchaseReservedCacheNodesOffering purchases a reserved cache node offering.

func (*InMemoryBackend) RebalanceSlotsInGlobalReplicationGroup

func (b *InMemoryBackend) RebalanceSlotsInGlobalReplicationGroup(
	_ context.Context,
	id string,
) (*GlobalReplicationGroup, error)

RebalanceSlotsInGlobalReplicationGroup rebalances slots.

func (*InMemoryBackend) RebootCacheCluster

func (b *InMemoryBackend) RebootCacheCluster(
	ctx context.Context,
	clusterID string,
	nodeIDs []string,
) (*Cluster, error)

RebootCacheCluster reboots a cache cluster.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the backend's default AWS region.

func (*InMemoryBackend) RemoveTagsFromResource

func (b *InMemoryBackend) RemoveTagsFromResource(_ context.Context, resourceARN string, tagKeys []string) error

RemoveTagsFromResource removes the specified tag keys from the resource identified by resourceARN.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset closes all miniredis instances, clears all state, and re-initialises default parameter groups.

func (*InMemoryBackend) ResetParameterGroup

func (b *InMemoryBackend) ResetParameterGroup(
	ctx context.Context,
	name string,
	paramNames []string,
	resetAll bool,
) (*CacheParameterGroup, error)

ResetParameterGroup resets parameters in a cache parameter group to defaults.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) RevokeCacheSecurityGroupIngress

func (b *InMemoryBackend) RevokeCacheSecurityGroupIngress(
	ctx context.Context,
	name, ec2SecurityGroupName, ec2SecurityGroupOwnerID string,
) (*CacheSecurityGroup, error)

RevokeCacheSecurityGroupIngress removes an EC2 security group authorization.

func (*InMemoryBackend) SetClock

func (b *InMemoryBackend) SetClock(clock func() time.Time)

SetClock overrides the backend clock. Primarily for deterministic tests that need to advance time past a transition deadline without sleeping. Passing nil restores time.Now. Safe for concurrent use.

func (*InMemoryBackend) SetDNSRegistrar

func (b *InMemoryBackend) SetDNSRegistrar(r DNSRegistrar)

SetDNSRegistrar wires a DNS server so cache cluster hostnames are automatically registered on create and deregistered on delete.

func (*InMemoryBackend) SetLifecycleDelay

func (b *InMemoryBackend) SetLifecycleDelay(d time.Duration)

SetLifecycleDelay configures how long resources dwell in an intermediate state before reaching their terminal state. Zero (the default) means transitions are instant. It is safe for concurrent use.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) StartMigration

func (b *InMemoryBackend) StartMigration(ctx context.Context, replicationGroupID string) (*ReplicationGroup, error)

StartMigration starts a migration for a replication group.

func (*InMemoryBackend) TestMigration

func (b *InMemoryBackend) TestMigration(ctx context.Context, replicationGroupID string) (*ReplicationGroup, error)

TestMigration tests a migration for a replication group.

func (*InMemoryBackend) TriggerAutoSnapshot

func (b *InMemoryBackend) TriggerAutoSnapshot(ctx context.Context, replicationGroupID string) (*CacheSnapshot, error)

TriggerAutoSnapshot creates an automated snapshot for the given replication group.

type LogDeliveryConfig

type LogDeliveryConfig struct {
	DestinationDetails string `json:"destinationDetails"`
	LogType            string `json:"logType"`         // "slow-log" or "engine-log"
	DestinationType    string `json:"destinationType"` // "cloudwatch-logs" or "kinesis-firehose"
	LogFormat          string `json:"logFormat"`       // "text" or "json"
	Status             string `json:"status"`
	Message            string `json:"message,omitempty"`
}

LogDeliveryConfig holds log delivery configuration for slow-log or engine-log (gap #6).

type NodeGroup

type NodeGroup struct {
	PrimaryNode *NodeGroupNode  `json:"primaryNode,omitempty"`
	NodeGroupID string          `json:"nodeGroupId"`
	Status      string          `json:"status"`
	Slots       string          `json:"slots"`
	Replicas    []NodeGroupNode `json:"replicas,omitempty"`
}

NodeGroup represents a shard / node group in a cluster-mode-enabled replication group (gap #2).

type NodeGroupNode

type NodeGroupNode struct {
	ReadEndpointAddress       string `json:"readEndpointAddress,omitempty"`
	CacheClusterID            string `json:"cacheClusterId"`
	CacheNodeID               string `json:"cacheNodeId"`
	CurrentRole               string `json:"currentRole"` // "primary" or "replica"
	PreferredAvailabilityZone string `json:"preferredAvailabilityZone"`
	ReadEndpointPort          int    `json:"readEndpointPort,omitempty"`
}

NodeGroupNode represents a single node within a node group (gap #2).

type Provider

type Provider struct{}

Provider implements service.Provider for the ElastiCache service.

func (*Provider) Init

Init initializes the ElastiCache service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the service provider name.

type RGPendingModifiedValues

type RGPendingModifiedValues struct {
	ReplicaCount            *int32 `json:"replicaCount,omitempty"`
	CacheNodeType           string `json:"cacheNodeType,omitempty"`
	EngineVersion           string `json:"engineVersion,omitempty"`
	AuthTokenStatus         string `json:"authTokenStatus,omitempty"`
	AutomaticFailoverStatus string `json:"automaticFailoverStatus,omitempty"`
}

RGPendingModifiedValues holds modifications queued for the next maintenance window (gap #7).

type ReplicationGroup

type ReplicationGroup struct {
	CreatedAt                  time.Time                `json:"createdAt"`
	AuthTokenLastModifiedDate  *time.Time               `json:"authTokenLastModifiedDate,omitempty"`
	AvailableAt                time.Time                `json:"availableAt,omitzero"`
	PendingModifiedValues      *RGPendingModifiedValues `json:"pendingModifiedValues,omitempty"`
	Tags                       *tags.Tags               `json:"tags,omitempty"`
	ReplicationGroupID         string                   `json:"replicationGroupID"`
	Description                string                   `json:"description"`
	Status                     string                   `json:"status"`
	PendingStatus              string                   `json:"pendingStatus,omitempty"`
	ARN                        string                   `json:"arn"`
	Engine                     string                   `json:"engine,omitempty"`
	CacheParameterGroupName    string                   `json:"cacheParameterGroupName,omitempty"`
	AutomaticFailover          string                   `json:"automaticFailover,omitempty"`
	EngineVersion              string                   `json:"engineVersion,omitempty"`
	CacheNodeType              string                   `json:"cacheNodeType,omitempty"`
	PreferredMaintenanceWindow string                   `json:"preferredMaintenanceWindow,omitempty"`
	SnapshotWindow             string                   `json:"snapshotWindow,omitempty"`
	AuthToken                  string                   `json:"authToken,omitempty"`
	KmsKeyID                   string                   `json:"kmsKeyId,omitempty"`
	NotificationTopicArn       string                   `json:"notificationTopicArn,omitempty"`
	TransitEncryptionMode      string                   `json:"transitEncryptionMode,omitempty"`
	NodeGroups                 []NodeGroup              `json:"nodeGroups,omitempty"`
	LogDeliveryConfigurations  []LogDeliveryConfig      `json:"logDeliveryConfigurations,omitempty"`
	UserGroupIDs               []string                 `json:"userGroupIds,omitempty"`
	SnapshotRetentionLimit     int                      `json:"snapshotRetentionLimit,omitempty"`
	ReplicaCount               int32                    `json:"replicaCount,omitempty"`
	ClusterModeEnabled         bool                     `json:"clusterModeEnabled,omitempty"`
	AuthTokenEnabled           bool                     `json:"authTokenEnabled,omitempty"`
	AtRestEncryptionEnabled    bool                     `json:"atRestEncryptionEnabled,omitempty"`
	TransitEncryptionEnabled   bool                     `json:"transitEncryptionEnabled,omitempty"`
	DataTieringEnabled         bool                     `json:"dataTieringEnabled,omitempty"`
	MultiAZEnabled             bool                     `json:"multiAZEnabled,omitempty"`
}

ReplicationGroup represents an ElastiCache replication group.

type ReplicationGroupCreateOpts

type ReplicationGroupCreateOpts struct {
	Tags               map[string]string
	Engine             string
	EngineVersion      string
	ID                 string
	Description        string
	ParameterGroupName string
	// SnapshotName, when set, restores the new replication group from an
	// existing snapshot: the snapshot must exist, and its engine/node type
	// become defaults for any field the caller didn't explicitly set.
	SnapshotName              string
	MaintenanceWindow         string
	TransitEncryptionMode     string
	AuthToken                 string
	KmsKeyID                  string
	NotificationTopicArn      string
	CacheNodeType             string
	SnapshotWindow            string
	UserGroupIDs              []string
	LogDeliveryConfigurations []LogDeliveryConfig
	SnapshotRetentionLimit    int
	ReplicasPerNodeGroup      int32
	NumNodeGroups             int32
	ClusterModeEnabled        bool
	AuthTokenEnabled          bool
	AtRestEncryptionEnabled   bool
	TransitEncryptionEnabled  bool
	DataTieringEnabled        bool
	AutomaticFailoverEnabled  bool
	MultiAZEnabled            bool
}

ReplicationGroupCreateOpts carries all fields for full replication-group creation.

type ReplicationGroupModifyOpts

type ReplicationGroupModifyOpts struct {
	SnapshotRetentionLimit    *int
	ReplicaCount              *int32
	AutomaticFailoverEnabled  *bool
	MultiAZEnabled            *bool
	Description               string
	ParameterGroupName        string
	EngineVersion             string
	CacheNodeType             string
	MaintenanceWindow         string
	SnapshotWindow            string
	AuthToken                 string
	AuthTokenUpdateStrategy   string
	NotificationTopicArn      string
	TransitEncryptionMode     string
	LogDeliveryConfigurations []LogDeliveryConfig
	UserGroupIDsToAdd         []string
	UserGroupIDsToRemove      []string
	ApplyImmediately          bool
}

ReplicationGroupModifyOpts carries all fields for full replication-group modification.

type ReservedCacheNode

type ReservedCacheNode struct {
	StartTime           time.Time `json:"startTime"`
	ReservationID       string    `json:"reservationID,omitempty"`
	ReservedCacheNodeID string    `json:"reservedCacheNodeID"`
	ARN                 string    `json:"arn"`
	CacheNodeType       string    `json:"cacheNodeType"`
	OfferingType        string    `json:"offeringType"`
	ProductDescription  string    `json:"productDescription"`
	State               string    `json:"state"`
	OfferingID          string    `json:"offeringID"`
	FixedPrice          float64   `json:"fixedPrice"`
	UsagePrice          float64   `json:"usagePrice"`
	Duration            int32     `json:"duration"`
	CacheNodeCount      int32     `json:"cacheNodeCount"`
}

ReservedCacheNode represents a purchased reserved cache node.

type ReservedCacheNodesOffering

type ReservedCacheNodesOffering struct {
	OfferingID         string
	CacheNodeType      string
	ProductDescription string
	OfferingType       string
	FixedPrice         float64
	UsagePrice         float64
	Duration           int32
}

ReservedCacheNodesOffering represents a reserved node offering.

type ServerlessCache

type ServerlessCache struct {
	CreatedAt              time.Time                `json:"createdAt"`
	AvailableAt            time.Time                `json:"availableAt,omitzero"`
	Tags                   *tags.Tags               `json:"tags,omitempty"`
	Endpoint               *ServerlessCacheEndpoint `json:"endpoint,omitempty"`
	ReaderEndpoint         *ServerlessCacheEndpoint `json:"readerEndpoint,omitempty"`
	Name                   string                   `json:"name"`
	Description            string                   `json:"description"`
	Status                 string                   `json:"status"`
	PendingStatus          string                   `json:"pendingStatus,omitempty"`
	ARN                    string                   `json:"arn"`
	Engine                 string                   `json:"engine"`
	KmsKeyID               string                   `json:"kmsKeyId,omitempty"`
	UserGroupID            string                   `json:"userGroupId,omitempty"`
	SubnetGroupName        string                   `json:"subnetGroupName,omitempty"`
	DailySnapshotTime      string                   `json:"dailySnapshotTime,omitempty"`
	MajorEngineVersion     string                   `json:"majorEngineVersion,omitempty"`
	SubnetIDs              []string                 `json:"subnetIds,omitempty"`
	SecurityGroupIDs       []string                 `json:"securityGroupIds,omitempty"`
	SnapshotRetentionLimit int32                    `json:"snapshotRetentionLimit,omitempty"`
}

ServerlessCache represents an ElastiCache serverless cache.

type ServerlessCacheEndpoint

type ServerlessCacheEndpoint struct {
	Address string `json:"address"`
	Port    int    `json:"port"`
}

ServerlessCacheEndpoint holds the address and port for a serverless cache endpoint.

type ServerlessCacheSnapshot

type ServerlessCacheSnapshot struct {
	CreatedAt           time.Time  `json:"createdAt"`
	Tags                *tags.Tags `json:"tags,omitempty"`
	Name                string     `json:"name"`
	Status              string     `json:"status"`
	ARN                 string     `json:"arn"`
	ServerlessCacheName string     `json:"serverlessCacheName"`
	SnapshotType        string     `json:"snapshotType"` // "manual" or "automated"
}

ServerlessCacheSnapshot represents a snapshot of a serverless cache.

type ServerlessCreateOpts

type ServerlessCreateOpts struct {
	Tags                   map[string]string
	Name                   string
	Description            string
	Engine                 string
	KmsKeyID               string
	UserGroupID            string
	SubnetGroupName        string
	DailySnapshotTime      string
	MajorEngineVersion     string
	SecurityGroupIDs       []string
	SubnetIDs              []string
	SnapshotRetentionLimit int32
}

ServerlessCreateOpts carries all fields for serverless cache creation.

type ServerlessModifyOpts

type ServerlessModifyOpts struct {
	SnapshotRetentionLimit *int32
	Description            string
	UserGroupID            string
	DailySnapshotTime      string
	SecurityGroupIDs       []string
	RemoveUserGroup        bool
}

ServerlessModifyOpts carries all fields for serverless cache modification.

type ServiceUpdate

type ServiceUpdate struct {
	ServiceUpdateName string
	Status            string
}

ServiceUpdate represents a service update.

func BuiltinServiceUpdates

func BuiltinServiceUpdates() []ServiceUpdate

BuiltinServiceUpdates returns a slice of pre-seeded service updates for testing realism.

type StorageBackend

type StorageBackend interface {
	CreateCluster(ctx context.Context, id, engine, nodeType string, port int) (*Cluster, error)
	CreateClusterWithOptions(
		ctx context.Context,
		id, engine, nodeType, paramGroupName, maintenanceWindow, snapshotWindow string,
		numCacheNodes, port int,
	) (*Cluster, error)
	DeleteCluster(ctx context.Context, id string) error
	DescribeClusters(ctx context.Context, id, marker string, maxRecords int, notInRG bool) (page.Page[Cluster], error)
	ModifyCluster(
		ctx context.Context,
		id, nodeType, paramGroupName, engineVersion, maintenanceWindow, snapshotWindow string,
		numCacheNodes int,
	) (*Cluster, error)
	ListTagsForResource(ctx context.Context, arn string) (map[string]string, error)
	AddTagsToResource(ctx context.Context, arn string, newTags map[string]string) error
	RemoveTagsFromResource(ctx context.Context, arn string, tagKeys []string) error
	CreateReplicationGroup(ctx context.Context, id, description string) (*ReplicationGroup, error)
	CreateReplicationGroupWithOptions(
		ctx context.Context,
		id, description, paramGroupName, maintenanceWindow, snapshotWindow string,
	) (*ReplicationGroup, error)
	DeleteReplicationGroup(ctx context.Context, id string) error
	DescribeReplicationGroups(
		ctx context.Context,
		id, marker string,
		maxRecords int,
	) (page.Page[ReplicationGroup], error)
	ModifyReplicationGroup(
		ctx context.Context,
		id, description, paramGroupName, engineVersion, cacheNodeType, maintenanceWindow, snapshotWindow string,
		automaticFailoverEnabled, multiAZEnabled *bool,
	) (*ReplicationGroup, error)
	FailoverReplicationGroup(ctx context.Context, id, nodeGroupID string) (*ReplicationGroup, error)
	CreateParameterGroup(ctx context.Context, name, family, description string) (*CacheParameterGroup, error)
	DeleteParameterGroup(ctx context.Context, name string) error
	DescribeParameterGroups(
		ctx context.Context,
		name, marker string,
		maxRecords int,
	) (page.Page[CacheParameterGroup], error)
	ModifyParameterGroup(ctx context.Context, name string, params map[string]string) (*CacheParameterGroup, error)
	ResetParameterGroup(
		ctx context.Context,
		name string,
		paramNames []string,
		resetAll bool,
	) (*CacheParameterGroup, error)
	DescribeParameters(ctx context.Context, name, marker string, maxRecords int) (page.Page[CacheParameter], error)
	CreateSubnetGroup(ctx context.Context, name, description string, subnetIDs []string) (*CacheSubnetGroup, error)
	CreateSubnetGroupFull(
		ctx context.Context,
		name, description, vpcID string,
		subnetIDs []string,
	) (*CacheSubnetGroup, error)
	DeleteSubnetGroup(ctx context.Context, name string) error
	DescribeSubnetGroups(ctx context.Context, name, marker string, maxRecords int) (page.Page[CacheSubnetGroup], error)
	ModifySubnetGroup(ctx context.Context, name, description string, subnetIDs []string) (*CacheSubnetGroup, error)
	CreateSnapshot(ctx context.Context, snapshotName, clusterID, replicationGroupID string) (*CacheSnapshot, error)
	DeleteSnapshot(ctx context.Context, snapshotName string) (*CacheSnapshot, error)
	DescribeSnapshots(
		ctx context.Context,
		snapshotName, clusterID, replicationGroupID, snapshotSource, marker string,
		maxRecords int,
	) (page.Page[CacheSnapshot], error)
	CopySnapshot(ctx context.Context, sourceSnapshotName, targetSnapshotName string) (*CacheSnapshot, error)
	CopySnapshotFull(
		ctx context.Context,
		sourceSnapshotName, targetSnapshotName, kmsKeyID string,
	) (*CacheSnapshot, error)
	DescribeEvents(
		ctx context.Context,
		sourceIdentifier, sourceType, marker string,
		startTime, endTime time.Time,
		duration, maxRecords int,
	) (page.Page[CacheEvent], error)
	// New ops
	CreateCacheSecurityGroup(ctx context.Context, name, description string) (*CacheSecurityGroup, error)
	AuthorizeCacheSecurityGroupIngress(
		ctx context.Context,
		name, ec2SecurityGroupName, ec2SecurityGroupOwnerID string,
	) (*CacheSecurityGroup, error)
	CreateGlobalReplicationGroup(
		ctx context.Context,
		globalReplicationGroupIDSuffix, description, primaryReplicationGroupID string,
	) (*GlobalReplicationGroup, error)
	CreateServerlessCache(ctx context.Context, name, description, engine string) (*ServerlessCache, error)
	CreateServerlessCacheSnapshot(
		ctx context.Context,
		snapshotName, serverlessCacheName string,
	) (*ServerlessCacheSnapshot, error)
	CopyServerlessCacheSnapshot(
		ctx context.Context,
		sourceSnapshotName, targetSnapshotName string,
	) (*ServerlessCacheSnapshot, error)
	CreateUser(
		ctx context.Context,
		userID, userName, accessString, engine string,
		noPasswordRequired bool,
	) (*User, error)
	BatchApplyUpdateAction(
		ctx context.Context,
		replicationGroupIDs, cacheClusterIDs []string,
		serviceUpdateName string,
	) (*BatchUpdateResult, error)
	BatchStopUpdateAction(
		ctx context.Context,
		replicationGroupIDs, cacheClusterIDs []string,
		serviceUpdateName string,
	) (*BatchUpdateResult, error)
	CompleteMigration(ctx context.Context, replicationGroupID string, force bool) (*ReplicationGroup, error)
	// User operations
	DeleteUser(ctx context.Context, userID string) (*User, error)
	DescribeUsers(ctx context.Context, userID, marker string, maxRecords int) (page.Page[User], error)
	ModifyUser(ctx context.Context, userID, accessString string, noPasswordRequired bool) (*User, error)
	// UserGroup operations
	CreateUserGroup(ctx context.Context, groupID, description, engine string, userIDs []string) (*UserGroup, error)
	CreateUserGroupValidated(
		ctx context.Context,
		groupID, description, engine string,
		userIDs []string,
	) (*UserGroup, error)
	DeleteUserGroup(ctx context.Context, groupID string) (*UserGroup, error)
	DescribeUserGroups(ctx context.Context, groupID, marker string, maxRecords int) (page.Page[UserGroup], error)
	ModifyUserGroup(ctx context.Context, groupID string, userIDsToAdd, userIDsToRemove []string) (*UserGroup, error)
	// GlobalReplicationGroup operations
	DeleteGlobalReplicationGroup(
		ctx context.Context,
		id string,
		retainPrimaryReplicationGroup bool,
	) (*GlobalReplicationGroup, error)
	DescribeGlobalReplicationGroups(
		ctx context.Context,
		id, marker string,
		maxRecords int,
	) (page.Page[GlobalReplicationGroup], error)
	DisassociateGlobalReplicationGroup(
		ctx context.Context,
		id, replicationGroupID, replicationGroupRegion string,
	) (*GlobalReplicationGroup, error)
	FailoverGlobalReplicationGroup(
		ctx context.Context,
		id, primaryRegion, primaryReplicationGroupID string,
	) (*GlobalReplicationGroup, error)
	IncreaseNodeGroupsInGlobalReplicationGroup(
		ctx context.Context,
		id string,
		nodeGroupCount int32,
	) (*GlobalReplicationGroup, error)
	DecreaseNodeGroupsInGlobalReplicationGroup(
		ctx context.Context,
		id string,
		nodeGroupCount int32,
	) (*GlobalReplicationGroup, error)
	ModifyGlobalReplicationGroup(
		ctx context.Context,
		id, description, engineVersion string,
		automaticFailoverEnabled bool,
	) (*GlobalReplicationGroup, error)
	RebalanceSlotsInGlobalReplicationGroup(ctx context.Context, id string) (*GlobalReplicationGroup, error)
	// ReservedCacheNodes operations
	DescribeReservedCacheNodes(
		ctx context.Context,
		id, cacheNodeType, offeringType, marker string,
		maxRecords int,
	) (page.Page[ReservedCacheNode], error)
	DescribeReservedCacheNodesOfferings(
		ctx context.Context,
		offeringID, cacheNodeType, offeringType, marker string,
		maxRecords int,
	) (page.Page[ReservedCacheNodesOffering], error)
	PurchaseReservedCacheNodesOffering(
		ctx context.Context,
		offeringID, reservedCacheNodeID string,
		cacheNodeCount int32,
	) (*ReservedCacheNode, error)
	// ServerlessCache operations
	DeleteServerlessCache(ctx context.Context, name string) (*ServerlessCache, error)
	DeleteServerlessCacheSnapshot(ctx context.Context, name string) (*ServerlessCacheSnapshot, error)
	DescribeServerlessCaches(
		ctx context.Context,
		name, marker string,
		maxRecords int,
	) (page.Page[ServerlessCache], error)
	DescribeServerlessCacheSnapshots(
		ctx context.Context,
		serverlessCacheName, snapshotName, marker string,
		maxRecords int,
	) (page.Page[ServerlessCacheSnapshot], error)
	ExportServerlessCacheSnapshot(
		ctx context.Context,
		snapshotName, s3BucketName string,
	) (*ServerlessCacheSnapshot, error)
	ModifyServerlessCache(ctx context.Context, name, description string) (*ServerlessCache, error)
	CreateServerlessCacheFull(ctx context.Context, opts ServerlessCreateOpts) (*ServerlessCache, error)
	ModifyServerlessCacheFull(ctx context.Context, name string, opts ServerlessModifyOpts) (*ServerlessCache, error)
	// Migration operations
	StartMigration(ctx context.Context, replicationGroupID string) (*ReplicationGroup, error)
	TestMigration(ctx context.Context, replicationGroupID string) (*ReplicationGroup, error)
	IncreaseReplicaCount(
		ctx context.Context,
		replicationGroupID string,
		newReplicaCount int32,
	) (*ReplicationGroup, error)
	DecreaseReplicaCount(
		ctx context.Context,
		replicationGroupID string,
		newReplicaCount int32,
	) (*ReplicationGroup, error)
	ModifyReplicationGroupShardConfiguration(
		ctx context.Context,
		replicationGroupID string,
		nodeGroupCount int32,
	) (*ReplicationGroup, error)
	// Cache info operations
	DescribeCacheEngineVersions(
		ctx context.Context,
		engine, family, engineVersion, marker string,
		maxRecords int,
	) (page.Page[CacheEngineVersion], error)
	RebootCacheCluster(ctx context.Context, clusterID string, nodeIDs []string) (*Cluster, error)
	DeleteCacheSecurityGroup(ctx context.Context, name string) error
	DescribeCacheSecurityGroups(
		ctx context.Context,
		name, marker string,
		maxRecords int,
	) (page.Page[CacheSecurityGroup], error)
	RevokeCacheSecurityGroupIngress(
		ctx context.Context,
		name, ec2SecurityGroupName, ec2SecurityGroupOwnerID string,
	) (*CacheSecurityGroup, error)
	DescribeEngineDefaultParameters(
		ctx context.Context,
		cacheParameterGroupFamily, marker string,
		maxRecords int,
	) (page.Page[CacheParameter], error)
	DescribeServiceUpdates(
		ctx context.Context,
		serviceUpdateName, marker string,
		maxRecords int,
		status []string,
	) (page.Page[ServiceUpdate], error)
	DescribeUpdateActions(
		ctx context.Context,
		serviceUpdateName, marker string,
		maxRecords int,
	) (page.Page[UpdateAction], error)
	ListAllowedNodeTypeModifications(ctx context.Context, clusterID, replicationGroupID string) ([]string, error)
	// Audit1: extended create/modify with new fields
	CreateReplicationGroupFull(ctx context.Context, opts ReplicationGroupCreateOpts) (*ReplicationGroup, error)
	ModifyReplicationGroupFull(
		ctx context.Context,
		id string,
		opts ReplicationGroupModifyOpts,
	) (*ReplicationGroup, error)
	// Audit1: auto snapshot scheduling
	TriggerAutoSnapshot(ctx context.Context, replicationGroupID string) (*CacheSnapshot, error)
	// Batch-2: update action tracking
	AppendUpdateActions(actions []*UpdateAction)
	ListUpdateActionsByServiceUpdate(serviceUpdateName string) []*UpdateAction
	// Region returns the backend's default AWS region.
	Region() string
}

StorageBackend defines the interface for the ElastiCache in-memory store.

type UpdateAction

type UpdateAction struct {
	ReplicationGroupID string
	CacheClusterID     string
	ServiceUpdateName  string
	UpdateActionStatus string
}

UpdateAction represents an update action.

type UpdateActionResult

type UpdateActionResult struct {
	ReplicationGroupID string `json:"replicationGroupId,omitempty"`
	CacheClusterID     string `json:"cacheClusterId,omitempty"`
	ServiceUpdateName  string `json:"serviceUpdateName"`
	UpdateActionStatus string `json:"updateActionStatus"`
}

UpdateActionResult represents the outcome of a single update action.

type User

type User struct {
	CreatedAt          time.Time  `json:"createdAt"`
	Tags               *tags.Tags `json:"tags,omitempty"`
	UserID             string     `json:"userId"`
	UserName           string     `json:"userName"`
	Status             string     `json:"status"`
	ARN                string     `json:"arn"`
	Engine             string     `json:"engine"`
	AccessString       string     `json:"accessString"`
	NoPasswordRequired bool       `json:"noPasswordRequired"`
}

User represents an ElastiCache user.

type UserGroup

type UserGroup struct {
	CreatedAt                   time.Time  `json:"createdAt"`
	Tags                        *tags.Tags `json:"tags,omitempty"`
	UserGroupID                 string     `json:"userGroupID"`
	Description                 string     `json:"description"`
	Status                      string     `json:"status"`
	ARN                         string     `json:"arn"`
	Engine                      string     `json:"engine"`
	UserIDs                     []string   `json:"userIDs,omitempty"`
	AssignedReplicationGroupIDs []string   `json:"assignedReplicationGroupIDs,omitempty"`
}

UserGroup represents an ElastiCache user group.

Jump to

Keyboard shortcuts

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