memorydb

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 23 Imported by: 0

README

MemoryDB

Parity grade: A · SDK aws-sdk-go-v2/service/memorydb@v1.33.12 · last audited 2026-07-23 (437393d5)

Coverage

Metric Value
Operations audited 46 (46 ok)
Feature families 8 (8 ok)
Known gaps 3
Deferred items 3
Resource leaks clean
Known gaps
  • ClusterConfiguration.Shards ([]ShardDetail) is not modeled: real AWS's Snapshot.ClusterConfiguration carries a full per-shard array (Configuration/ShardConfiguration sub-object with Slots/ReplicaCount, Name, Size, SnapshotCreationTime -- confirmed via types.ShardDetail and its deserializer). snapshotClusterConfig has none of this. Not fixed: would require designing new shard-level snapshot metadata tracking this backend does not currently have (Size/per-shard SnapshotCreationTime aren't derivable from anything already tracked); fabricating plausible-looking values would itself violate the no-stub rule.
  • ServiceUpdate.ClusterName/NodesUpdated are not modeled: a real ServiceUpdate entry is scoped to one specific cluster it applies to (the real API effectively returns one row per (update, affected cluster) pair). This backend models service updates as global objects with zero cluster association, so DescribeServiceUpdatesInput.ClusterNames is parsed but not applied as a filter, and the two per-cluster fields cannot be populated without fabricating an association. Not fixed: needs real design work on how service updates relate to clusters, not a shallow field add.
  • DescribeSnapshotsInput.ShowDetail (real field, gates whether ClusterConfiguration is included in the response, mirroring ShowShardDetails/ShowClusterDetails elsewhere in this service) is not implemented -- ClusterConfiguration is currently always included when non-empty, with no request-side toggle. Not fixed this pass; same shape of fix as the ShowClusterDetails work done for DescribeMultiRegionClusters, just not reached.
Deferred
  • Byte-for-byte audit of nested shardObject/nodeObject beyond the fields already spot-checked (Name, Status, Slots, Nodes, NumberOfNodes on Shard; AvailabilityZone, CreateTime, Endpoint, Name, Status on Node) -- these matched exactly against types.Shard/types.Node's deserializer case lists when checked this pass, but the full request-shape interaction with real Slots math (16384 keyspace distribution) was not independently verified against live AWS.
  • MultiRegionCluster.Clusters' RegionalCluster.Status semantics beyond "reflects the underlying Cluster.Status" -- real AWS may report a distinct Region-membership status (e.g. "active"/"creating"/"deleting" scoped to the multi-Region relationship itself) rather than just mirroring the Regional cluster's own Status; not independently confirmable without live AWS.
  • PurchaseReservedNodesOffering / DescribeReservedNodesOfferings RecurringCharges frequency/amount realism (values are mock placeholders, e.g. "Hourly") -- wire shape (RecurringChargeAmount/RecurringChargeFrequency) confirmed correct, but the actual pricing data is illustrative, not derived from any real AWS price list (same caveat as every other service's pricing mocks).

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClusterNotFound is returned when a cluster does not exist.
	ErrClusterNotFound = awserr.New("ClusterNotFoundFault: cluster not found", awserr.ErrNotFound)
	// ErrClusterAlreadyExists is returned when a cluster already exists.
	ErrClusterAlreadyExists = awserr.New("ClusterAlreadyExistsFault: cluster already exists", awserr.ErrAlreadyExists)
	// ErrACLNotFound is returned when an ACL does not exist.
	ErrACLNotFound = awserr.New("ACLNotFoundFault: ACL not found", awserr.ErrNotFound)
	// ErrACLAlreadyExists is returned when an ACL already exists.
	ErrACLAlreadyExists = awserr.New("ACLAlreadyExistsFault: ACL already exists", awserr.ErrAlreadyExists)
	// ErrSubnetGroupNotFound is returned when a subnet group does not exist.
	ErrSubnetGroupNotFound = awserr.New("SubnetGroupNotFoundFault: subnet group not found", awserr.ErrNotFound)
	// ErrSubnetGroupAlreadyExists is returned when a subnet group already exists.
	ErrSubnetGroupAlreadyExists = awserr.New(
		"SubnetGroupAlreadyExistsFault: subnet group already exists",
		awserr.ErrAlreadyExists,
	)
	// ErrUserNotFound is returned when a user does not exist.
	ErrUserNotFound = awserr.New("UserNotFoundFault: user not found", awserr.ErrNotFound)
	// ErrUserAlreadyExists is returned when a user already exists.
	ErrUserAlreadyExists = awserr.New("UserAlreadyExistsFault: user already exists", awserr.ErrAlreadyExists)
	// ErrParameterGroupNotFound is returned when a parameter group does not exist.
	ErrParameterGroupNotFound = awserr.New("ParameterGroupNotFoundFault: parameter group not found", awserr.ErrNotFound)
	// ErrParameterGroupAlreadyExists is returned when a parameter group already exists.
	ErrParameterGroupAlreadyExists = awserr.New(
		"ParameterGroupAlreadyExistsFault: parameter group already exists",
		awserr.ErrAlreadyExists,
	)
	// ErrSnapshotNotFound is returned when a snapshot does not exist.
	ErrSnapshotNotFound = awserr.New("SnapshotNotFoundFault: snapshot not found", awserr.ErrNotFound)
	// ErrSnapshotAlreadyExists is returned when a snapshot already exists.
	ErrSnapshotAlreadyExists = awserr.New(
		"SnapshotAlreadyExistsFault: snapshot already exists",
		awserr.ErrAlreadyExists,
	)
	// ErrMultiRegionClusterNotFound is returned when a multi-region cluster does not exist.
	ErrMultiRegionClusterNotFound = awserr.New(
		"MultiRegionClusterNotFoundFault: multi-region cluster not found",
		awserr.ErrNotFound,
	)
	// ErrMultiRegionClusterAlreadyExists is returned when a multi-region cluster already exists.
	ErrMultiRegionClusterAlreadyExists = awserr.New(
		"MultiRegionClusterAlreadyExistsFault: multi-region cluster already exists",
		awserr.ErrAlreadyExists,
	)
	// ErrMultiRegionParameterGroupNotFound is returned when a multi-region parameter group does not exist.
	ErrMultiRegionParameterGroupNotFound = awserr.New(
		"MultiRegionParameterGroupNotFoundFault: multi-region parameter group not found",
		awserr.ErrNotFound,
	)
	// ErrSubnetGroupInUse is returned when a subnet group cannot be deleted because it
	// is assigned to a cluster (real AWS fault: SubnetGroupInUseFault).
	ErrSubnetGroupInUse = awserr.New(
		"SubnetGroupInUseFault: subnet group is currently associated with a cluster",
		awserr.ErrConflict,
	)
	// ErrACLInUse is returned when an ACL cannot be deleted because it is assigned to a
	// cluster (real AWS fault: InvalidACLStateFault).
	ErrACLInUse = awserr.New(
		"InvalidACLStateFault: ACL is currently associated with a cluster",
		awserr.ErrConflict,
	)
	// ErrUserInUse is returned when a user cannot be deleted because it is a member of
	// an ACL (real AWS fault: InvalidUserStateFault).
	ErrUserInUse = awserr.New(
		"InvalidUserStateFault: user is currently a member of an ACL",
		awserr.ErrConflict,
	)
	// ErrInvalidARN is returned by the tagging operations (ListTags/TagResource/
	// UntagResource) when the given ResourceArn does not match any known
	// resource (real AWS fault: InvalidARNFault -- the only NotFound-family
	// fault those three operations' models actually define for an unmatched ARN).
	ErrInvalidARN = awserr.New("InvalidARNFault: resource not found for the given ARN", awserr.ErrNotFound)
	// ErrReservationAlreadyExists is returned when a reserved node with the same ID already exists.
	ErrReservationAlreadyExists = awserr.New(
		"ReservedNodeAlreadyExistsFault: reserved node already exists",
		awserr.ErrAlreadyExists,
	)
)

Errors used by the backend.

View Source
var ErrNilAppContext = errors.New("nil AppContext passed to MemoryDB Provider.Init")

ErrNilAppContext is returned by Init when a nil AppContext is passed.

View Source
var ErrValidation = awserr.New("InvalidParameterValueException", awserr.ErrInvalidParameter)

ErrValidation is returned when input validation fails.

Functions

func ACLCount

func ACLCount(b *InMemoryBackend) int

ACLCount returns the number of ACLs in the backend.

func ARNIndexSize

func ARNIndexSize(b *InMemoryBackend) int

ARNIndexSize returns the number of entries in the ARN-to-resource index.

func ClusterCount

func ClusterCount(b *InMemoryBackend) int

ClusterCount returns the number of clusters in the backend.

func EventCount

func EventCount(b *InMemoryBackend) int

EventCount returns the number of events in the backend.

func HandlerOpsLen

func HandlerOpsLen(h *Handler) int

HandlerOpsLen returns the number of supported operations reported by the handler.

func MultiRegionClusterCount

func MultiRegionClusterCount(b *InMemoryBackend) int

MultiRegionClusterCount returns the number of multi-region clusters in the backend.

func ParameterGroupCount

func ParameterGroupCount(b *InMemoryBackend) int

ParameterGroupCount returns the number of parameter groups in the backend.

func SnapshotCount

func SnapshotCount(b *InMemoryBackend) int

SnapshotCount returns the number of snapshots in the backend.

func SubnetGroupCount

func SubnetGroupCount(b *InMemoryBackend) int

SubnetGroupCount returns the number of subnet groups in the backend.

func UserCount

func UserCount(b *InMemoryBackend) int

UserCount returns the number of users in the backend.

Types

type ACL

type ACL struct {
	CreatedAt time.Time         `json:"createdAt"`
	Tags      map[string]string `json:"tags"`
	ARN       string            `json:"arn"`
	Name      string            `json:"name"`
	Status    string            `json:"status"`
	UserNames []string          `json:"userNames"`
}

ACL represents an in-memory MemoryDB Access Control List.

type Cluster

type Cluster struct {
	CreatedAt               time.Time         `json:"createdAt"`
	AvailableAt             time.Time         `json:"availableAt"`
	Tags                    map[string]string `json:"tags"`
	KmsKeyID                string            `json:"kmsKeyID"`
	SnsTopicArn             string            `json:"snsTopicArn"`
	SnsTopicStatus          string            `json:"snsTopicStatus"`
	Description             string            `json:"description"`
	NodeType                string            `json:"nodeType"`
	EngineVersion           string            `json:"engineVersion"`
	ACLName                 string            `json:"aclName"`
	SubnetGroupName         string            `json:"subnetGroupName"`
	ParameterGroupName      string            `json:"parameterGroupName"`
	ParameterGroupStatus    string            `json:"parameterGroupStatus"`
	MultiRegionClusterName  string            `json:"multiRegionClusterName"`
	Status                  string            `json:"status"`
	PendingStatus           string            `json:"pendingStatus"`
	MaintenanceWindow       string            `json:"maintenanceWindow"`
	Name                    string            `json:"name"`
	ARN                     string            `json:"arn"`
	Region                  string            `json:"region"`
	SnapshotWindow          string            `json:"snapshotWindow"`
	Endpoint                string            `json:"endpoint"`
	AvailabilityMode        string            `json:"availabilityMode"`
	Engine                  string            `json:"engine"`
	DataTiering             string            `json:"dataTiering"`
	NetworkType             string            `json:"networkType"`
	IPDiscovery             string            `json:"ipDiscovery"`
	SecurityGroupIDs        []string          `json:"securityGroupIDs"`
	NumReplicasPerShard     int32             `json:"numReplicasPerShard"`
	SnapshotRetentionLimit  int32             `json:"snapshotRetentionLimit"`
	Port                    int32             `json:"port"`
	NumShards               int32             `json:"numShards"`
	TLSEnabled              bool              `json:"tlsEnabled"`
	AutoMinorVersionUpgrade bool              `json:"autoMinorVersionUpgrade"`
}

Cluster represents an in-memory MemoryDB cluster.

PendingStatus/AvailableAt implement the goroutine-free "creating" -> "available" lifecycle overlay (see lifecycle.go): PendingStatus holds the transient status observed until the backend clock passes AvailableAt, at which point Status (the terminal value) takes over. Both are zero-valued (no-op) unless SetLifecycleDelay has been configured, preserving the pre-existing instant-available behavior by default.

type EngineVersion

type EngineVersion struct {
	Engine               string `json:"engine"`
	EngineVersion        string `json:"engineVersion"`
	EnginePatchVersion   string `json:"enginePatchVersion"`
	ParameterGroupFamily string `json:"parameterGroupFamily"`
	Description          string `json:"description"`
}

EngineVersion describes a supported MemoryDB engine version. Description is internal-only documentation for the seed table (defaultEngineVersions) -- it is NOT part of the wire response (see engineVersionObject's doc comment).

type Event

type Event struct {
	Date       time.Time `json:"date"`
	SourceName string    `json:"sourceName"`
	SourceType string    `json:"sourceType"`
	Message    string    `json:"message"`
}

Event represents a MemoryDB event.

type ExportedAuthModeReq

type ExportedAuthModeReq = authenticationModeReq

ExportedAuthModeReq aliases authenticationModeReq for testing.

type ExportedCluster

type ExportedCluster = Cluster

ExportedCluster is a compatibility alias used by the dashboard package.

type ExportedCopySnapshotRequest

type ExportedCopySnapshotRequest = copySnapshotRequest

ExportedCopySnapshotRequest aliases copySnapshotRequest for testing.

type ExportedCreateACLRequest

type ExportedCreateACLRequest = createACLRequest

ExportedCreateACLRequest aliases createACLRequest for testing.

type ExportedCreateClusterRequest

type ExportedCreateClusterRequest = createClusterRequest

ExportedCreateClusterRequest aliases createClusterRequest for testing.

type ExportedCreateMultiRegionClusterRequest

type ExportedCreateMultiRegionClusterRequest = createMultiRegionClusterRequest

ExportedCreateMultiRegionClusterRequest aliases createMultiRegionClusterRequest for testing.

type ExportedCreateParameterGroupRequest

type ExportedCreateParameterGroupRequest = createParameterGroupRequest

ExportedCreateParameterGroupRequest aliases createParameterGroupRequest for testing.

type ExportedCreateSnapshotRequest

type ExportedCreateSnapshotRequest = createSnapshotRequest

ExportedCreateSnapshotRequest aliases createSnapshotRequest for testing.

type ExportedCreateSubnetGroupRequest

type ExportedCreateSubnetGroupRequest = createSubnetGroupRequest

ExportedCreateSubnetGroupRequest aliases createSubnetGroupRequest for testing.

type ExportedCreateUserRequest

type ExportedCreateUserRequest = createUserRequest

ExportedCreateUserRequest aliases createUserRequest for testing.

type ExportedDescribeEngineVersionsRequest

type ExportedDescribeEngineVersionsRequest = describeEngineVersionsRequest

ExportedDescribeEngineVersionsRequest aliases describeEngineVersionsRequest for testing.

type ExportedDescribeEventsRequest

type ExportedDescribeEventsRequest = describeEventsRequest

ExportedDescribeEventsRequest aliases describeEventsRequest for testing.

type ExportedDescribeReservedNodesRequest

type ExportedDescribeReservedNodesRequest = describeReservedNodesRequest

ExportedDescribeReservedNodesRequest aliases describeReservedNodesRequest for testing.

type ExportedEngineVersion

type ExportedEngineVersion = EngineVersion

ExportedEngineVersion aliases EngineVersion for testing.

type ExportedEvent

type ExportedEvent = Event

ExportedEvent aliases Event for testing.

type ExportedPurchaseReservedNodesOfferingRequest

type ExportedPurchaseReservedNodesOfferingRequest = purchaseReservedNodesOfferingRequest

ExportedPurchaseReservedNodesOfferingRequest aliases purchaseReservedNodesOfferingRequest for testing.

type ExportedResetParameterGroupRequest

type ExportedResetParameterGroupRequest = resetParameterGroupRequest

ExportedResetParameterGroupRequest aliases resetParameterGroupRequest for testing.

type ExportedUpdateClusterRequest

type ExportedUpdateClusterRequest = updateClusterRequest

ExportedUpdateClusterRequest aliases updateClusterRequest for testing.

type ExportedUpdateMultiRegionClusterRequest

type ExportedUpdateMultiRegionClusterRequest = updateMultiRegionClusterRequest

ExportedUpdateMultiRegionClusterRequest aliases updateMultiRegionClusterRequest for testing.

type Handler

type Handler struct {
	Backend       StorageBackend
	AccountID     string
	DefaultRegion string
}

Handler is the HTTP handler for the AWS MemoryDB JSON 1.1 API.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a new MemoryDB 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 handler 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 operation name from the X-Amz-Target header.

func (*Handler) ExtractResource

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

ExtractResource extracts the primary resource name from the request body.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations returns the list of supported MemoryDB operations.

func (*Handler) Handler

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

Handler returns the Echo handler function for MemoryDB 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) Purge

func (h *Handler) Purge(ctx context.Context, cutoff time.Time)

Purge implements service.Purgeable by removing all MemoryDB resources older than cutoff.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all state by delegating to the backend.

func (*Handler) Restore

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

func (*Handler) RouteMatcher

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

RouteMatcher returns a function that matches MemoryDB JSON 1.1 API requests.

func (*Handler) Snapshot

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

type InMemoryBackend

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

InMemoryBackend is the in-memory implementation of StorageBackend.

multiRegionClusters, multiRegionParameterGroups, and serviceUpdates are partition-scoped (like AWS) and therefore NOT region-nested; they are registered on registry so Reset/Snapshot/Restore collapse to one Registry call each. Every other resource is nested per-region (map[string]*store.Table[T], outer key is region) via the lazy "*Store" accessors below. Per-region tables are deliberately NOT registered on registry because the set of regions is only known at runtime -- see store_setup.go and persistence.go for how they are (de)serialized instead.

arnToResource and events are left as plain maps: arnToResource's value (resourceRef) has no key of its own to feed a Table's keyFn (the ARN is the map key, not a value field), and events is slice-valued (map[string][]*Event), neither of which store.Table can represent.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

func (*InMemoryBackend) AddACLInternal

func (b *InMemoryBackend) AddACLInternal(name string) *ACL

AddACLInternal inserts an ACL directly into the backend for testing.

func (*InMemoryBackend) AddClusterInternal

func (b *InMemoryBackend) AddClusterInternal(name, nodeType string) *Cluster

AddClusterInternal inserts a cluster directly into the backend for testing.

func (*InMemoryBackend) AddEvent

func (b *InMemoryBackend) AddEvent(ev *Event)

AddEvent appends an event to the backend event log (used internally for seeding). Events are capped at maxEvents; oldest entries are dropped when the cap is reached.

func (*InMemoryBackend) AddMultiRegionParameterGroupInternal

func (b *InMemoryBackend) AddMultiRegionParameterGroupInternal(name, family string) *MultiRegionParameterGroup

AddMultiRegionParameterGroupInternal inserts a multi-region parameter group directly into the backend for testing.

func (*InMemoryBackend) AddParameterGroupInternal

func (b *InMemoryBackend) AddParameterGroupInternal(name, family string) *ParameterGroup

AddParameterGroupInternal inserts a parameter group directly into the backend for testing.

func (*InMemoryBackend) AddSnapshotInternal

func (b *InMemoryBackend) AddSnapshotInternal(name, clusterName string) *Snapshot

AddSnapshotInternal inserts a snapshot directly into the backend for testing.

func (*InMemoryBackend) AddSubnetGroupInternal

func (b *InMemoryBackend) AddSubnetGroupInternal(name string) *SubnetGroup

AddSubnetGroupInternal inserts a subnet group directly into the backend for testing.

func (*InMemoryBackend) AddUserInternal

func (b *InMemoryBackend) AddUserInternal(name, accessString string) *User

AddUserInternal inserts a user directly into the backend for testing.

func (*InMemoryBackend) BatchUpdateCluster

func (b *InMemoryBackend) BatchUpdateCluster(ctx context.Context, clusterNames []string) map[string]*Cluster

BatchUpdateCluster looks up each named cluster and returns a map of name→cluster for all clusters that were found. Unknown names are omitted from the result. The caller is responsible for deciding which names are processed vs unprocessed.

func (*InMemoryBackend) CopySnapshot

func (b *InMemoryBackend) CopySnapshot(ctx context.Context, req *copySnapshotRequest) (*Snapshot, error)

CopySnapshot copies an existing snapshot to a new name.

func (*InMemoryBackend) CreateACL

func (b *InMemoryBackend) CreateACL(ctx context.Context, req *createACLRequest) (*ACL, error)

CreateACL creates a new ACL.

func (*InMemoryBackend) CreateCluster

func (b *InMemoryBackend) CreateCluster(ctx context.Context, req *createClusterRequest) (*Cluster, error)

func (*InMemoryBackend) CreateMultiRegionCluster

func (b *InMemoryBackend) CreateMultiRegionCluster(
	ctx context.Context,
	req *createMultiRegionClusterRequest,
) (*MultiRegionCluster, error)

CreateMultiRegionCluster creates a new multi-region cluster.

func (*InMemoryBackend) CreateParameterGroup

func (b *InMemoryBackend) CreateParameterGroup(
	ctx context.Context,
	req *createParameterGroupRequest,
) (*ParameterGroup, error)

CreateParameterGroup creates a new parameter group.

func (*InMemoryBackend) CreateSnapshot

func (b *InMemoryBackend) CreateSnapshot(ctx context.Context, req *createSnapshotRequest) (*Snapshot, error)

CreateSnapshot creates a snapshot of a cluster.

func (*InMemoryBackend) CreateSubnetGroup

func (b *InMemoryBackend) CreateSubnetGroup(ctx context.Context, req *createSubnetGroupRequest) (*SubnetGroup, error)

CreateSubnetGroup creates a new subnet group.

func (*InMemoryBackend) CreateUser

func (b *InMemoryBackend) CreateUser(ctx context.Context, req *createUserRequest) (*User, error)

CreateUser creates a new MemoryDB user.

func (*InMemoryBackend) DeleteACL

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

DeleteACL removes an ACL.

func (*InMemoryBackend) DeleteCluster

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

DeleteCluster removes a cluster.

func (*InMemoryBackend) DeleteClusterWithSnapshot

func (b *InMemoryBackend) DeleteClusterWithSnapshot(
	ctx context.Context,
	clusterName, snapshotName string,
) (*Cluster, error)

DeleteClusterWithSnapshot removes a cluster, first creating a snapshot with the given name.

func (*InMemoryBackend) DeleteMultiRegionCluster

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

DeleteMultiRegionCluster removes a multi-region cluster.

func (*InMemoryBackend) DeleteParameterGroup

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

DeleteParameterGroup removes a parameter group.

func (*InMemoryBackend) DeleteSnapshot

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

DeleteSnapshot removes a snapshot.

func (*InMemoryBackend) DeleteSubnetGroup

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

DeleteSubnetGroup removes a subnet group.

func (*InMemoryBackend) DeleteUser

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

DeleteUser removes a user.

func (*InMemoryBackend) DescribeACLs

func (b *InMemoryBackend) DescribeACLs(ctx context.Context, name string) ([]*ACL, error)

DescribeACLs returns ACLs, optionally filtered by name.

func (*InMemoryBackend) DescribeClusters

func (b *InMemoryBackend) DescribeClusters(ctx context.Context, name string) ([]*Cluster, error)

DescribeClusters returns clusters, optionally filtered by name.

func (*InMemoryBackend) DescribeEngineVersions

func (b *InMemoryBackend) DescribeEngineVersions(
	_ context.Context,
	req *describeEngineVersionsRequest,
) ([]*EngineVersion, error)

DescribeEngineVersions returns supported engine versions, optionally filtered.

func (*InMemoryBackend) DescribeEvents

func (b *InMemoryBackend) DescribeEvents(_ context.Context, req *describeEventsRequest) ([]*Event, error)

DescribeEvents returns events, optionally filtered by source name and type.

func (*InMemoryBackend) DescribeMultiRegionClusters

func (b *InMemoryBackend) DescribeMultiRegionClusters(_ context.Context, name string) ([]*MultiRegionCluster, error)

DescribeMultiRegionClusters returns multi-region clusters, optionally filtered by name.

func (*InMemoryBackend) DescribeMultiRegionParameterGroups

func (b *InMemoryBackend) DescribeMultiRegionParameterGroups(
	_ context.Context,
	name string,
) ([]*MultiRegionParameterGroup, error)

DescribeMultiRegionParameterGroups returns multi-region parameter groups, optionally filtered by name.

func (*InMemoryBackend) DescribeMultiRegionParameters

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

DescribeMultiRegionParameters returns the parameters for a multi-region parameter group.

func (*InMemoryBackend) DescribeParameterGroups

func (b *InMemoryBackend) DescribeParameterGroups(ctx context.Context, name string) ([]*ParameterGroup, error)

DescribeParameterGroups returns parameter groups, optionally filtered by name.

func (*InMemoryBackend) DescribeParameters

func (b *InMemoryBackend) DescribeParameters(
	ctx context.Context,
	parameterGroupName string,
) (map[string]string, error)

DescribeParameters returns the parameters map for a given parameter group.

func (*InMemoryBackend) DescribeReservedNodes

func (b *InMemoryBackend) DescribeReservedNodes(
	ctx context.Context,
	req *describeReservedNodesRequest,
) ([]*ReservedNode, error)

DescribeReservedNodes returns reserved nodes, optionally filtered by reservation ID or node type.

func (*InMemoryBackend) DescribeReservedNodesOfferings

func (b *InMemoryBackend) DescribeReservedNodesOfferings(
	_ context.Context,
	req *describeReservedNodesOfferingsRequest,
) ([]*ReservedNodesOffering, error)

DescribeReservedNodesOfferings returns available reserved node offerings.

func (*InMemoryBackend) DescribeServiceUpdates

func (b *InMemoryBackend) DescribeServiceUpdates(
	_ context.Context,
	req *describeServiceUpdatesRequest,
) ([]*ServiceUpdate, error)

DescribeServiceUpdates returns service updates, optionally filtered.

func (*InMemoryBackend) DescribeSnapshots

func (b *InMemoryBackend) DescribeSnapshots(
	ctx context.Context,
	name, clusterName, source string,
) ([]*Snapshot, error)

DescribeSnapshots returns snapshots, optionally filtered by name, cluster name, or source.

func (*InMemoryBackend) DescribeSubnetGroups

func (b *InMemoryBackend) DescribeSubnetGroups(ctx context.Context, name string) ([]*SubnetGroup, error)

DescribeSubnetGroups returns subnet groups, optionally filtered by name.

func (*InMemoryBackend) DescribeUsers

func (b *InMemoryBackend) DescribeUsers(ctx context.Context, name string) ([]*User, error)

DescribeUsers returns users, optionally filtered by name.

func (*InMemoryBackend) ExportSnapshot

func (b *InMemoryBackend) ExportSnapshot(ctx context.Context, req *exportSnapshotRequest) (*Snapshot, error)

ExportSnapshot validates the snapshot exists and returns it (export to S3 is a no-op in the mock).

func (*InMemoryBackend) FailoverShard

func (b *InMemoryBackend) FailoverShard(ctx context.Context, clusterName, shardName string) (*Cluster, error)

FailoverShard simulates a shard failover for a cluster, returning the cluster state.

func (*InMemoryBackend) ListAllowedMultiRegionClusterUpdates

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

ListAllowedMultiRegionClusterUpdates returns the set of node types a multi-region cluster can be updated to.

func (*InMemoryBackend) ListAllowedNodeTypeUpdates

func (b *InMemoryBackend) ListAllowedNodeTypeUpdates(ctx context.Context, clusterName string) ([]string, error)

ListAllowedNodeTypeUpdates returns the set of node types a cluster can be updated to.

func (*InMemoryBackend) ListClusters

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

ListClusters returns all clusters for use by the dashboard.

func (*InMemoryBackend) ListTags

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

ListTags returns the tags for a resource identified by ARN.

func (*InMemoryBackend) PurchaseReservedNodesOffering

func (b *InMemoryBackend) PurchaseReservedNodesOffering(
	ctx context.Context,
	req *purchaseReservedNodesOfferingRequest,
) (*ReservedNode, error)

PurchaseReservedNodesOffering creates a new reserved node from an offering.

func (*InMemoryBackend) Purge

func (b *InMemoryBackend) Purge(ctx context.Context, cutoff time.Time)

Purge removes all MemoryDB resources created before the cutoff time.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

func (*InMemoryBackend) RegionalClustersFor added in v1.2.0

func (b *InMemoryBackend) RegionalClustersFor(multiRegionClusterName string) []*Cluster

RegionalClustersFor returns the per-Region clusters belonging to the named multi-Region cluster, sorted by region then cluster name for determinism. Populates MultiRegionCluster.Clusters (types.RegionalCluster in the real SDK) on the wire response. Safe for concurrent use.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state and re-seeds defaults, returning the backend to a clean state.

func (*InMemoryBackend) ResetParameterGroup

func (b *InMemoryBackend) ResetParameterGroup(
	ctx context.Context,
	name string,
	parameterNames []string,
	allParameters bool,
) (*ParameterGroup, error)

ResetParameterGroup resets parameters in a parameter group back to family defaults. If parameterNames is non-empty and allParameters is false, only those keys are reset. If allParameters is true or parameterNames is empty, all parameters are reset.

func (*InMemoryBackend) Restore

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

Restore loads backend state from a JSON snapshot.

func (*InMemoryBackend) SetClock added in v1.2.0

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) SetLifecycleDelay added in v1.2.0

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

SetLifecycleDelay configures how long a newly created cluster dwells in the "creating" state before reaching "available". Zero (the default) means the transition is instant. Safe for concurrent use.

func (*InMemoryBackend) Snapshot

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

Snapshot serialises the backend state to JSON.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(_ context.Context, resourceArn string, tags map[string]string) error

TagResource adds or updates tags on a resource.

func (*InMemoryBackend) UntagResource

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

UntagResource removes tags from a resource.

func (*InMemoryBackend) UpdateACL

func (b *InMemoryBackend) UpdateACL(ctx context.Context, req *updateACLRequest) (*ACL, error)

UpdateACL modifies an existing ACL.

func (*InMemoryBackend) UpdateCluster

func (b *InMemoryBackend) UpdateCluster(ctx context.Context, req *updateClusterRequest) (*Cluster, error)

UpdateCluster modifies an existing cluster.

func (*InMemoryBackend) UpdateMultiRegionCluster

func (b *InMemoryBackend) UpdateMultiRegionCluster(
	_ context.Context,
	req *updateMultiRegionClusterRequest,
) (*MultiRegionCluster, error)

UpdateMultiRegionCluster modifies an existing multi-region cluster.

func (*InMemoryBackend) UpdateParameterGroup

func (b *InMemoryBackend) UpdateParameterGroup(
	ctx context.Context,
	req *updateParameterGroupRequest,
) (*ParameterGroup, error)

UpdateParameterGroup modifies parameter values in a parameter group.

func (*InMemoryBackend) UpdateSubnetGroup

func (b *InMemoryBackend) UpdateSubnetGroup(ctx context.Context, req *updateSubnetGroupRequest) (*SubnetGroup, error)

UpdateSubnetGroup modifies an existing subnet group.

func (*InMemoryBackend) UpdateUser

func (b *InMemoryBackend) UpdateUser(ctx context.Context, req *updateUserRequest) (*User, error)

UpdateUser modifies an existing user.

type MultiRegionCluster

type MultiRegionCluster struct {
	CreatedAt                     time.Time         `json:"createdAt"`
	Tags                          map[string]string `json:"tags"`
	ARN                           string            `json:"arn"`
	MultiRegionClusterName        string            `json:"multiRegionClusterName"`
	Description                   string            `json:"description"`
	NodeType                      string            `json:"nodeType"`
	Engine                        string            `json:"engine"`
	EngineVersion                 string            `json:"engineVersion"`
	MultiRegionParameterGroupName string            `json:"multiRegionParameterGroupName"`
	Status                        string            `json:"status"`
	TLSEnabled                    bool              `json:"tlsEnabled"`
}

MultiRegionCluster represents an in-memory MemoryDB multi-region cluster.

type MultiRegionParameterGroup

type MultiRegionParameterGroup struct {
	CreatedAt   time.Time         `json:"createdAt"`
	Tags        map[string]string `json:"tags"`
	Parameters  map[string]string `json:"parameters"`
	ARN         string            `json:"arn"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Family      string            `json:"family"`
}

MultiRegionParameterGroup represents an in-memory MemoryDB multi-region parameter group.

type ParameterGroup

type ParameterGroup struct {
	CreatedAt   time.Time         `json:"createdAt"`
	Tags        map[string]string `json:"tags"`
	Parameters  map[string]string `json:"parameters"`
	ARN         string            `json:"arn"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Family      string            `json:"family"`
}

ParameterGroup represents an in-memory MemoryDB parameter group.

type Provider

type Provider struct{}

Provider implements service.Provider for the MemoryDB service.

func (*Provider) Init

Init initializes the MemoryDB service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type ReservedNode

type ReservedNode struct {
	ReservationID           string                  `json:"ReservationId,omitempty"`
	ReservedNodesOfferingID string                  `json:"ReservedNodesOfferingId,omitempty"`
	NodeType                string                  `json:"NodeType,omitempty"`
	OfferingType            string                  `json:"OfferingType,omitempty"`
	State                   string                  `json:"State,omitempty"`
	ARN                     string                  `json:"ARN,omitempty"`
	RecurringCharges        []recurringChargeObject `json:"RecurringCharges,omitempty"`
	FixedPrice              float64                 `json:"FixedPrice,omitempty"`
	StartTime               float64                 `json:"StartTime,omitempty"`
	NodeCount               int32                   `json:"NodeCount,omitempty"`
	Duration                int32                   `json:"Duration,omitempty"`
}

ReservedNode represents a reserved MemoryDB node. StartTime is epoch seconds (float64), matching the real ReservedNode TStamp shape; this struct is serialized directly as the wire response (see describeReservedNodesResponse / purchaseReservedNodesOfferingResponse), so its field types must match the wire, not just internal convenience.

NOTE: the real SDK's ReservedNode type (aws-sdk-go-v2/service/memorydb/types) has NO "ReservedNodeId" field -- confirmed against deserializers.go's awsAwsjson11_deserializeDocumentReservedNode, which only recognizes ARN, Duration, FixedPrice, NodeCount, NodeType, OfferingType, RecurringCharges, ReservationId, ReservedNodesOfferingId, StartTime, State. A prior pass invented "ReservedNodeId" (and used it as the unique/filter key) while omitting the real "ReservedNodesOfferingId" field entirely; fixed here. It also invented a "UsagePrice" field on both ReservedNode and ReservedNodesOffering -- confirmed absent from both types' real deserializers (awsAwsjson11_deserializeDocumentReservedNode and awsAwsjson11_deserializeDocumentReservedNodesOffering); deleted.

type ReservedNodesOffering

type ReservedNodesOffering struct {
	ReservedNodesOfferingID string                  `json:"ReservedNodesOfferingId,omitempty"`
	NodeType                string                  `json:"NodeType,omitempty"`
	OfferingType            string                  `json:"OfferingType,omitempty"`
	RecurringCharges        []recurringChargeObject `json:"RecurringCharges,omitempty"`
	FixedPrice              float64                 `json:"FixedPrice,omitempty"`
	Duration                int32                   `json:"Duration,omitempty"`
}

ReservedNodesOffering describes a reserved node offering.

type ServiceUpdate

type ServiceUpdate struct {
	ReleaseDate         time.Time `json:"releaseDate"`
	AutoUpdateStartDate time.Time `json:"autoUpdateStartDate"`
	ServiceUpdateName   string    `json:"serviceUpdateName"`
	Description         string    `json:"description"`
	Status              string    `json:"status"`
	Type                string    `json:"type"`
	Engine              string    `json:"engine"`
}

ServiceUpdate represents an in-memory MemoryDB service update.

NOTE: the real SDK's ServiceUpdate type also has "ClusterName" and "NodesUpdated" fields (confirmed via deserializers.go's awsAwsjson11_deserializeDocumentServiceUpdate), reflecting that a real ServiceUpdate entry is scoped to a specific cluster it applies to. This backend models service updates as global (not tied to specific clusters), so those two fields aren't modeled -- see PARITY.md gaps (adding fabricated placeholder values would itself violate the no-stub rule).

type Snapshot

type Snapshot struct {
	CreatedAt            time.Time             `json:"createdAt"`
	Tags                 map[string]string     `json:"tags"`
	ARN                  string                `json:"arn"`
	Name                 string                `json:"name"`
	ClusterName          string                `json:"clusterName"`
	Status               string                `json:"status"`
	KmsKeyID             string                `json:"kmsKeyID"`
	Source               string                `json:"source"`
	DataTiering          string                `json:"dataTiering"`
	ClusterConfiguration snapshotClusterConfig `json:"clusterConfiguration"`
}

Snapshot represents an in-memory MemoryDB snapshot.

NOTE: no "SnapshotType" field -- deleted (see snapshotObject's doc comment). It duplicated Source (every call site set both to the same value); Source is now the single source of truth internally too.

type StorageBackend

type StorageBackend interface {
	CreateCluster(ctx context.Context, req *createClusterRequest) (*Cluster, error)
	DescribeClusters(ctx context.Context, name string) ([]*Cluster, error)
	DeleteCluster(ctx context.Context, name string) (*Cluster, error)
	DeleteClusterWithSnapshot(ctx context.Context, clusterName, snapshotName string) (*Cluster, error)
	UpdateCluster(ctx context.Context, req *updateClusterRequest) (*Cluster, error)
	CreateACL(ctx context.Context, req *createACLRequest) (*ACL, error)
	DescribeACLs(ctx context.Context, name string) ([]*ACL, error)
	DeleteACL(ctx context.Context, name string) (*ACL, error)
	UpdateACL(ctx context.Context, req *updateACLRequest) (*ACL, error)
	CreateSubnetGroup(ctx context.Context, req *createSubnetGroupRequest) (*SubnetGroup, error)
	DescribeSubnetGroups(ctx context.Context, name string) ([]*SubnetGroup, error)
	DeleteSubnetGroup(ctx context.Context, name string) (*SubnetGroup, error)
	UpdateSubnetGroup(ctx context.Context, req *updateSubnetGroupRequest) (*SubnetGroup, error)
	CreateUser(ctx context.Context, req *createUserRequest) (*User, error)
	DescribeUsers(ctx context.Context, name string) ([]*User, error)
	DeleteUser(ctx context.Context, name string) (*User, error)
	UpdateUser(ctx context.Context, req *updateUserRequest) (*User, error)
	CreateParameterGroup(ctx context.Context, req *createParameterGroupRequest) (*ParameterGroup, error)
	DescribeParameterGroups(ctx context.Context, name string) ([]*ParameterGroup, error)
	DeleteParameterGroup(ctx context.Context, name string) (*ParameterGroup, error)
	UpdateParameterGroup(ctx context.Context, req *updateParameterGroupRequest) (*ParameterGroup, error)
	ListTags(ctx context.Context, resourceArn string) (map[string]string, error)
	TagResource(ctx context.Context, resourceArn string, tags map[string]string) error
	UntagResource(ctx context.Context, resourceArn string, tagKeys []string) error
	CreateSnapshot(ctx context.Context, req *createSnapshotRequest) (*Snapshot, error)
	DescribeSnapshots(ctx context.Context, name, clusterName, source string) ([]*Snapshot, error)
	CopySnapshot(ctx context.Context, req *copySnapshotRequest) (*Snapshot, error)
	DeleteSnapshot(ctx context.Context, name string) (*Snapshot, error)
	ExportSnapshot(ctx context.Context, req *exportSnapshotRequest) (*Snapshot, error)
	DescribeEngineVersions(ctx context.Context, req *describeEngineVersionsRequest) ([]*EngineVersion, error)
	DescribeEvents(ctx context.Context, req *describeEventsRequest) ([]*Event, error)
	CreateMultiRegionCluster(ctx context.Context, req *createMultiRegionClusterRequest) (*MultiRegionCluster, error)
	DeleteMultiRegionCluster(ctx context.Context, name string) (*MultiRegionCluster, error)
	DescribeMultiRegionClusters(ctx context.Context, name string) ([]*MultiRegionCluster, error)
	UpdateMultiRegionCluster(ctx context.Context, req *updateMultiRegionClusterRequest) (*MultiRegionCluster, error)
	RegionalClustersFor(multiRegionClusterName string) []*Cluster
	DescribeMultiRegionParameterGroups(ctx context.Context, name string) ([]*MultiRegionParameterGroup, error)
	DescribeParameters(ctx context.Context, parameterGroupName string) (map[string]string, error)
	ResetParameterGroup(
		ctx context.Context,
		name string,
		parameterNames []string,
		allParameters bool,
	) (*ParameterGroup, error)
	FailoverShard(ctx context.Context, clusterName, shardConfiguration string) (*Cluster, error)
	ListAllowedNodeTypeUpdates(ctx context.Context, clusterName string) ([]string, error)
	ListAllowedMultiRegionClusterUpdates(ctx context.Context, clusterName string) ([]string, error)
	BatchUpdateCluster(ctx context.Context, clusterNames []string) map[string]*Cluster
	DescribeReservedNodes(ctx context.Context, req *describeReservedNodesRequest) ([]*ReservedNode, error)
	DescribeReservedNodesOfferings(
		ctx context.Context,
		req *describeReservedNodesOfferingsRequest,
	) ([]*ReservedNodesOffering, error)
	PurchaseReservedNodesOffering(ctx context.Context, req *purchaseReservedNodesOfferingRequest) (*ReservedNode, error)
	DescribeMultiRegionParameters(ctx context.Context, parameterGroupName string) (map[string]string, error)
	DescribeServiceUpdates(ctx context.Context, req *describeServiceUpdatesRequest) ([]*ServiceUpdate, error)
	Region() string
	Reset()
	Snapshot(ctx context.Context) []byte
	Restore(ctx context.Context, data []byte) error
}

StorageBackend is the interface for the MemoryDB in-memory backend.

type SubnetGroup

type SubnetGroup struct {
	CreatedAt   time.Time         `json:"createdAt"`
	Tags        map[string]string `json:"tags"`
	ARN         string            `json:"arn"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	VPCID       string            `json:"vpcID"`
	SubnetIDs   []string          `json:"subnetIDs"`
}

SubnetGroup represents an in-memory MemoryDB subnet group.

type User

type User struct {
	CreatedAt    time.Time         `json:"createdAt"`
	Tags         map[string]string `json:"tags"`
	ARN          string            `json:"arn"`
	Name         string            `json:"name"`
	AccessString string            `json:"accessString"`
	Status       string            `json:"status"`
	AuthType     string            `json:"authType"`
	Passwords    []string          `json:"passwords"`
}

User represents an in-memory MemoryDB user.

Jump to

Keyboard shortcuts

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