Documentation
¶
Index ¶
- Variables
- func ACLCount(b *InMemoryBackend) int
- func ARNIndexSize(b *InMemoryBackend) int
- func ClusterCount(b *InMemoryBackend) int
- func EventCount(b *InMemoryBackend) int
- func HandlerOpsLen(h *Handler) int
- func MultiRegionClusterCount(b *InMemoryBackend) int
- func ParameterGroupCount(b *InMemoryBackend) int
- func SnapshotCount(b *InMemoryBackend) int
- func SubnetGroupCount(b *InMemoryBackend) int
- func UserCount(b *InMemoryBackend) int
- type ACL
- type Cluster
- type EngineVersion
- type Event
- type ExportedAuthModeReq
- type ExportedCluster
- type ExportedCopySnapshotRequest
- type ExportedCreateACLRequest
- type ExportedCreateClusterRequest
- type ExportedCreateMultiRegionClusterRequest
- type ExportedCreateParameterGroupRequest
- type ExportedCreateSnapshotRequest
- type ExportedCreateSubnetGroupRequest
- type ExportedCreateUserRequest
- type ExportedDescribeEngineVersionsRequest
- type ExportedDescribeEventsRequest
- type ExportedDescribeReservedNodesRequest
- type ExportedEngineVersion
- type ExportedEvent
- type ExportedPurchaseReservedNodesOfferingRequest
- type ExportedResetParameterGroupRequest
- type ExportedUpdateClusterRequest
- type ExportedUpdateMultiRegionClusterRequest
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Purge(ctx context.Context, cutoff time.Time)
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) AddACLInternal(name string) *ACL
- func (b *InMemoryBackend) AddClusterInternal(name, nodeType string) *Cluster
- func (b *InMemoryBackend) AddEvent(ev *Event)
- func (b *InMemoryBackend) AddMultiRegionParameterGroupInternal(name, family string) *MultiRegionParameterGroup
- func (b *InMemoryBackend) AddParameterGroupInternal(name, family string) *ParameterGroup
- func (b *InMemoryBackend) AddSnapshotInternal(name, clusterName string) *Snapshot
- func (b *InMemoryBackend) AddSubnetGroupInternal(name string) *SubnetGroup
- func (b *InMemoryBackend) AddUserInternal(name, accessString string) *User
- func (b *InMemoryBackend) BatchUpdateCluster(ctx context.Context, clusterNames []string) map[string]*Cluster
- func (b *InMemoryBackend) CopySnapshot(ctx context.Context, req *copySnapshotRequest) (*Snapshot, error)
- func (b *InMemoryBackend) CreateACL(ctx context.Context, req *createACLRequest) (*ACL, error)
- func (b *InMemoryBackend) CreateCluster(ctx context.Context, req *createClusterRequest) (*Cluster, error)
- func (b *InMemoryBackend) CreateMultiRegionCluster(ctx context.Context, req *createMultiRegionClusterRequest) (*MultiRegionCluster, error)
- func (b *InMemoryBackend) CreateParameterGroup(ctx context.Context, req *createParameterGroupRequest) (*ParameterGroup, error)
- func (b *InMemoryBackend) CreateSnapshot(ctx context.Context, req *createSnapshotRequest) (*Snapshot, error)
- func (b *InMemoryBackend) CreateSubnetGroup(ctx context.Context, req *createSubnetGroupRequest) (*SubnetGroup, error)
- func (b *InMemoryBackend) CreateUser(ctx context.Context, req *createUserRequest) (*User, error)
- func (b *InMemoryBackend) DeleteACL(ctx context.Context, name string) (*ACL, error)
- func (b *InMemoryBackend) DeleteCluster(ctx context.Context, name string) (*Cluster, error)
- func (b *InMemoryBackend) DeleteClusterWithSnapshot(ctx context.Context, clusterName, snapshotName string) (*Cluster, error)
- func (b *InMemoryBackend) DeleteMultiRegionCluster(ctx context.Context, name string) (*MultiRegionCluster, error)
- func (b *InMemoryBackend) DeleteParameterGroup(ctx context.Context, name string) (*ParameterGroup, error)
- func (b *InMemoryBackend) DeleteSnapshot(ctx context.Context, name string) (*Snapshot, error)
- func (b *InMemoryBackend) DeleteSubnetGroup(ctx context.Context, name string) (*SubnetGroup, error)
- func (b *InMemoryBackend) DeleteUser(ctx context.Context, name string) (*User, error)
- func (b *InMemoryBackend) DescribeACLs(ctx context.Context, name string) ([]*ACL, error)
- func (b *InMemoryBackend) DescribeClusters(ctx context.Context, name string) ([]*Cluster, error)
- func (b *InMemoryBackend) DescribeEngineVersions(_ context.Context, req *describeEngineVersionsRequest) ([]*EngineVersion, error)
- func (b *InMemoryBackend) DescribeEvents(_ context.Context, req *describeEventsRequest) ([]*Event, error)
- func (b *InMemoryBackend) DescribeMultiRegionClusters(_ context.Context, name string) ([]*MultiRegionCluster, error)
- func (b *InMemoryBackend) DescribeMultiRegionParameterGroups(_ context.Context, name string) ([]*MultiRegionParameterGroup, error)
- func (b *InMemoryBackend) DescribeMultiRegionParameters(_ context.Context, parameterGroupName string) (map[string]string, error)
- func (b *InMemoryBackend) DescribeParameterGroups(ctx context.Context, name string) ([]*ParameterGroup, error)
- func (b *InMemoryBackend) DescribeParameters(ctx context.Context, parameterGroupName string) (map[string]string, error)
- func (b *InMemoryBackend) DescribeReservedNodes(ctx context.Context, req *describeReservedNodesRequest) ([]*ReservedNode, error)
- func (b *InMemoryBackend) DescribeReservedNodesOfferings(_ context.Context, req *describeReservedNodesOfferingsRequest) ([]*ReservedNodesOffering, error)
- func (b *InMemoryBackend) DescribeServiceUpdates(_ context.Context, req *describeServiceUpdatesRequest) ([]*ServiceUpdate, error)
- func (b *InMemoryBackend) DescribeSnapshots(ctx context.Context, name, clusterName, snapshotType, source string) ([]*Snapshot, error)
- func (b *InMemoryBackend) DescribeSubnetGroups(ctx context.Context, name string) ([]*SubnetGroup, error)
- func (b *InMemoryBackend) DescribeUsers(ctx context.Context, name string) ([]*User, error)
- func (b *InMemoryBackend) ExportSnapshot(ctx context.Context, req *exportSnapshotRequest) (*Snapshot, error)
- func (b *InMemoryBackend) FailoverShard(ctx context.Context, clusterName, shardName string) (*Cluster, error)
- func (b *InMemoryBackend) ListAllowedMultiRegionClusterUpdates(_ context.Context, clusterName string) ([]string, error)
- func (b *InMemoryBackend) ListAllowedNodeTypeUpdates(ctx context.Context, clusterName string) ([]string, error)
- func (b *InMemoryBackend) ListClusters() []*Cluster
- func (b *InMemoryBackend) ListTags(_ context.Context, resourceArn string) (map[string]string, error)
- func (b *InMemoryBackend) PurchaseReservedNodesOffering(ctx context.Context, req *purchaseReservedNodesOfferingRequest) (*ReservedNode, error)
- func (b *InMemoryBackend) Purge(ctx context.Context, cutoff time.Time)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) ResetParameterGroup(ctx context.Context, name string, parameterNames []string, allParameters bool) (*ParameterGroup, error)
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(_ context.Context, resourceArn string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(_ context.Context, resourceArn string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateACL(ctx context.Context, req *updateACLRequest) (*ACL, error)
- func (b *InMemoryBackend) UpdateCluster(ctx context.Context, req *updateClusterRequest) (*Cluster, error)
- func (b *InMemoryBackend) UpdateMultiRegionCluster(_ context.Context, req *updateMultiRegionClusterRequest) (*MultiRegionCluster, error)
- func (b *InMemoryBackend) UpdateParameterGroup(ctx context.Context, req *updateParameterGroupRequest) (*ParameterGroup, error)
- func (b *InMemoryBackend) UpdateSubnetGroup(ctx context.Context, req *updateSubnetGroupRequest) (*SubnetGroup, error)
- func (b *InMemoryBackend) UpdateUser(ctx context.Context, req *updateUserRequest) (*User, error)
- type MultiRegionCluster
- type MultiRegionParameterGroup
- type ParameterGroup
- type Provider
- type ReservedNode
- type ReservedNodesOffering
- type ServiceUpdate
- type Snapshot
- type StorageBackend
- type SubnetGroup
- type User
Constants ¶
This section is empty.
Variables ¶
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.
var ErrNilAppContext = errors.New("nil AppContext passed to MemoryDB Provider.Init")
ErrNilAppContext is returned by Init when a nil AppContext is passed.
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 ¶
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"`
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"`
MultiRegionParameterGroupName string `json:"multiRegionParameterGroupName"`
Status string `json:"status"`
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.
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.
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 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 ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this handler handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the operation name from the X-Amz-Target header.
func (*Handler) ExtractResource ¶
ExtractResource extracts the primary resource name from the request body.
func (*Handler) GetSupportedOperations ¶
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 ¶
MatchPriority returns the routing priority.
func (*Handler) Purge ¶
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) RouteMatcher ¶
RouteMatcher returns a function that matches MemoryDB JSON 1.1 API requests.
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) DeleteCluster ¶
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 ¶
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 ¶
DeleteUser removes a user.
func (*InMemoryBackend) DescribeACLs ¶
DescribeACLs returns ACLs, optionally filtered by name.
func (*InMemoryBackend) DescribeClusters ¶
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, snapshotType, source string, ) ([]*Snapshot, error)
DescribeSnapshots returns snapshots, optionally filtered by name, cluster name, snapshot type, 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 ¶
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) 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) 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"`
}
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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the MemoryDB service backend and handler.
type ReservedNode ¶
type ReservedNode struct {
ReservedNodeID string `json:"ReservedNodeId,omitempty"`
ReservationID string `json:"ReservationId,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"`
UsagePrice float64 `json:"UsagePrice,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.
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"`
UsagePrice float64 `json:"UsagePrice,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"`
}
ServiceUpdate represents an in-memory MemoryDB service update.
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"`
SnapshotType string `json:"snapshotType"`
Source string `json:"source"`
ClusterConfiguration snapshotClusterConfig `json:"clusterConfiguration"`
}
Snapshot represents an in-memory MemoryDB snapshot.
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, snapshotType, 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)
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"`
Engine string `json:"engine"`
AccessString string `json:"accessString"`
Status string `json:"status"`
AuthType string `json:"authType"`
Passwords []string `json:"passwords"`
}
User represents an in-memory MemoryDB user.
Source Files
¶
- acls.go
- clusters.go
- engine_versions.go
- errors.go
- events.go
- exports.go
- handler.go
- handler_acls.go
- handler_clusters.go
- handler_engine_versions.go
- handler_events.go
- handler_multi_region_clusters.go
- handler_parameter_groups.go
- handler_reserved_nodes.go
- handler_service_updates.go
- handler_snapshots.go
- handler_subnet_groups.go
- handler_tags.go
- handler_users.go
- interfaces.go
- models.go
- models_acls.go
- models_clusters.go
- models_engine_versions.go
- models_events.go
- models_multi_region_clusters.go
- models_parameter_groups.go
- models_reserved_nodes.go
- models_service_updates.go
- models_snapshots.go
- models_subnet_groups.go
- models_tags.go
- models_users.go
- multi_region_clusters.go
- parameter_groups.go
- persistence.go
- provider.go
- purge.go
- reserved_nodes.go
- service_updates.go
- snapshots.go
- store.go
- store_setup.go
- subnet_groups.go
- tags.go
- users.go