memorydb

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package memorydb provides AWS MemoryDB service emulation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL struct {
	ARN                  string             `json:"ARN,omitempty"`
	Clusters             []string           `json:"Clusters,omitempty"`
	MinimumEngineVersion string             `json:"MinimumEngineVersion,omitempty"`
	Name                 string             `json:"Name,omitempty"`
	PendingChanges       *ACLPendingChanges `json:"PendingChanges,omitempty"`
	Status               string             `json:"Status,omitempty"`
	UserNames            []string           `json:"UserNames,omitempty"`
}

ACL represents a MemoryDB access control list.

type ACLPendingChanges

type ACLPendingChanges struct {
	UserNamesToAdd    []string `json:"UserNamesToAdd,omitempty"`
	UserNamesToRemove []string `json:"UserNamesToRemove,omitempty"`
}

ACLPendingChanges represents pending ACL changes.

type Authentication

type Authentication struct {
	PasswordCount int32  `json:"PasswordCount,omitempty"`
	Type          string `json:"Type,omitempty"`
}

Authentication represents user authentication info.

type AuthenticationMode

type AuthenticationMode struct {
	Passwords []string `json:"Passwords,omitempty"`
	Type      string   `json:"Type,omitempty"`
}

AuthenticationMode represents user authentication mode in request.

type Cluster

type Cluster struct {
	ACLName                 string                    `json:"ACLName,omitempty"`
	ARN                     string                    `json:"ARN,omitempty"`
	AutoMinorVersionUpgrade bool                      `json:"AutoMinorVersionUpgrade,omitempty"`
	AvailabilityMode        string                    `json:"AvailabilityMode,omitempty"`
	ClusterEndpoint         *Endpoint                 `json:"ClusterEndpoint,omitempty"`
	Description             string                    `json:"Description,omitempty"`
	Engine                  string                    `json:"Engine,omitempty"`
	EngineVersion           string                    `json:"EngineVersion,omitempty"`
	KmsKeyID                string                    `json:"KmsKeyId,omitempty"`
	MaintenanceWindow       string                    `json:"MaintenanceWindow,omitempty"`
	Name                    string                    `json:"Name,omitempty"`
	NodeType                string                    `json:"NodeType,omitempty"`
	NumberOfShards          int32                     `json:"NumberOfShards,omitempty"`
	ParameterGroupName      string                    `json:"ParameterGroupName,omitempty"`
	ParameterGroupStatus    string                    `json:"ParameterGroupStatus,omitempty"`
	SecurityGroups          []SecurityGroupMembership `json:"SecurityGroups,omitempty"`
	SnapshotRetentionLimit  int32                     `json:"SnapshotRetentionLimit,omitempty"`
	SnapshotWindow          string                    `json:"SnapshotWindow,omitempty"`
	SnsTopicArn             string                    `json:"SnsTopicArn,omitempty"`
	SnsTopicStatus          string                    `json:"SnsTopicStatus,omitempty"`
	Status                  string                    `json:"Status,omitempty"`
	SubnetGroupName         string                    `json:"SubnetGroupName,omitempty"`
	TLSEnabled              bool                      `json:"TLSEnabled,omitempty"`
}

Cluster represents a MemoryDB cluster.

type CreateACLRequest

type CreateACLRequest struct {
	ACLName   string   `json:"ACLName"`
	UserNames []string `json:"UserNames,omitempty"`
	Tags      []Tag    `json:"Tags,omitempty"`
}

CreateACLRequest represents a CreateACL request.

type CreateACLResponse

type CreateACLResponse struct {
	ACL *ACL `json:"ACL"`
}

CreateACLResponse represents a CreateACL response.

type CreateClusterRequest

type CreateClusterRequest struct {
	ACLName                 string   `json:"ACLName"`
	ClusterName             string   `json:"ClusterName"`
	NodeType                string   `json:"NodeType"`
	AutoMinorVersionUpgrade *bool    `json:"AutoMinorVersionUpgrade,omitempty"`
	Description             string   `json:"Description,omitempty"`
	Engine                  string   `json:"Engine,omitempty"`
	EngineVersion           string   `json:"EngineVersion,omitempty"`
	KmsKeyID                string   `json:"KmsKeyId,omitempty"`
	MaintenanceWindow       string   `json:"MaintenanceWindow,omitempty"`
	NumReplicasPerShard     *int32   `json:"NumReplicasPerShard,omitempty"`
	NumShards               *int32   `json:"NumShards,omitempty"`
	ParameterGroupName      string   `json:"ParameterGroupName,omitempty"`
	Port                    *int32   `json:"Port,omitempty"`
	SecurityGroupIDs        []string `json:"SecurityGroupIds,omitempty"`
	SnapshotRetentionLimit  *int32   `json:"SnapshotRetentionLimit,omitempty"`
	SnapshotWindow          string   `json:"SnapshotWindow,omitempty"`
	SubnetGroupName         string   `json:"SubnetGroupName,omitempty"`
	TLSEnabled              *bool    `json:"TLSEnabled,omitempty"`
	Tags                    []Tag    `json:"Tags,omitempty"`
}

CreateClusterRequest represents a CreateCluster request.

type CreateClusterResponse

type CreateClusterResponse struct {
	Cluster *Cluster `json:"Cluster"`
}

CreateClusterResponse represents a CreateCluster response.

type CreateUserRequest

type CreateUserRequest struct {
	AccessString       string              `json:"AccessString"`
	AuthenticationMode *AuthenticationMode `json:"AuthenticationMode"`
	UserName           string              `json:"UserName"`
	Tags               []Tag               `json:"Tags,omitempty"`
}

CreateUserRequest represents a CreateUser request.

type CreateUserResponse

type CreateUserResponse struct {
	User *User `json:"User"`
}

CreateUserResponse represents a CreateUser response.

type DeleteACLRequest

type DeleteACLRequest struct {
	ACLName string `json:"ACLName"`
}

DeleteACLRequest represents a DeleteACL request.

type DeleteACLResponse

type DeleteACLResponse struct {
	ACL *ACL `json:"ACL"`
}

DeleteACLResponse represents a DeleteACL response.

type DeleteClusterRequest

type DeleteClusterRequest struct {
	ClusterName string `json:"ClusterName"`
}

DeleteClusterRequest represents a DeleteCluster request.

type DeleteClusterResponse

type DeleteClusterResponse struct {
	Cluster *Cluster `json:"Cluster"`
}

DeleteClusterResponse represents a DeleteCluster response.

type DeleteUserRequest

type DeleteUserRequest struct {
	UserName string `json:"UserName"`
}

DeleteUserRequest represents a DeleteUser request.

type DeleteUserResponse

type DeleteUserResponse struct {
	User *User `json:"User"`
}

DeleteUserResponse represents a DeleteUser response.

type DescribeACLsRequest

type DescribeACLsRequest struct {
	ACLName    string `json:"ACLName,omitempty"`
	MaxResults int32  `json:"MaxResults,omitempty"`
	NextToken  string `json:"NextToken,omitempty"`
}

DescribeACLsRequest represents a DescribeACLs request.

type DescribeACLsResponse

type DescribeACLsResponse struct {
	ACLs      []ACL  `json:"ACLs"`
	NextToken string `json:"NextToken,omitempty"`
}

DescribeACLsResponse represents a DescribeACLs response.

type DescribeClustersRequest

type DescribeClustersRequest struct {
	ClusterName string `json:"ClusterName,omitempty"`
	MaxResults  int32  `json:"MaxResults,omitempty"`
	NextToken   string `json:"NextToken,omitempty"`
}

DescribeClustersRequest represents a DescribeClusters request.

type DescribeClustersResponse

type DescribeClustersResponse struct {
	Clusters  []Cluster `json:"Clusters"`
	NextToken string    `json:"NextToken,omitempty"`
}

DescribeClustersResponse represents a DescribeClusters response.

type DescribeUsersRequest

type DescribeUsersRequest struct {
	UserName   string `json:"UserName,omitempty"`
	MaxResults int32  `json:"MaxResults,omitempty"`
	NextToken  string `json:"NextToken,omitempty"`
}

DescribeUsersRequest represents a DescribeUsers request.

type DescribeUsersResponse

type DescribeUsersResponse struct {
	Users     []User `json:"Users"`
	NextToken string `json:"NextToken,omitempty"`
}

DescribeUsersResponse represents a DescribeUsers response.

type Endpoint

type Endpoint struct {
	Address string `json:"Address"`
	Port    int32  `json:"Port"`
}

Endpoint represents a cluster endpoint.

type ErrorResponse

type ErrorResponse struct {
	Type    string `json:"__type"`
	Message string `json:"message"`
}

ErrorResponse represents an error response.

type MemoryStorage

type MemoryStorage struct {
	Clusters map[string]*Cluster `json:"clusters"`
	Users    map[string]*User    `json:"users"`
	Acls     map[string]*ACL     `json:"acls"`
	// contains filtered or unexported fields
}

MemoryStorage implements Storage with in-memory data.

func NewMemoryStorage

func NewMemoryStorage(opts ...Option) *MemoryStorage

NewMemoryStorage creates a new MemoryStorage.

func (*MemoryStorage) Close added in v0.6.0

func (m *MemoryStorage) Close() error

Close saves the storage state to disk if persistence is enabled.

func (*MemoryStorage) CreateACL

func (m *MemoryStorage) CreateACL(_ context.Context, req *CreateACLRequest) (*ACL, error)

CreateACL creates a new ACL.

func (*MemoryStorage) CreateCluster

func (m *MemoryStorage) CreateCluster(_ context.Context, req *CreateClusterRequest) (*Cluster, error)

CreateCluster creates a new cluster.

func (*MemoryStorage) CreateUser

func (m *MemoryStorage) CreateUser(_ context.Context, req *CreateUserRequest) (*User, error)

CreateUser creates a new user.

func (*MemoryStorage) DeleteACL

func (m *MemoryStorage) DeleteACL(_ context.Context, aclName string) (*ACL, error)

DeleteACL deletes an ACL.

func (*MemoryStorage) DeleteCluster

func (m *MemoryStorage) DeleteCluster(_ context.Context, clusterName string) (*Cluster, error)

DeleteCluster deletes a cluster.

func (*MemoryStorage) DeleteUser

func (m *MemoryStorage) DeleteUser(_ context.Context, userName string) (*User, error)

DeleteUser deletes a user.

func (*MemoryStorage) DescribeACLs

func (m *MemoryStorage) DescribeACLs(_ context.Context, aclName string) ([]ACL, error)

DescribeACLs returns ACLs matching the filter.

func (*MemoryStorage) DescribeClusters

func (m *MemoryStorage) DescribeClusters(_ context.Context, clusterName string) ([]Cluster, error)

DescribeClusters returns clusters matching the filter.

func (*MemoryStorage) DescribeUsers

func (m *MemoryStorage) DescribeUsers(_ context.Context, userName string) ([]User, error)

DescribeUsers returns users matching the filter.

func (*MemoryStorage) MarshalJSON added in v0.6.0

func (m *MemoryStorage) MarshalJSON() ([]byte, error)

MarshalJSON serializes the storage state to JSON.

func (*MemoryStorage) UnmarshalJSON added in v0.6.0

func (m *MemoryStorage) UnmarshalJSON(data []byte) error

UnmarshalJSON restores the storage state from JSON.

func (*MemoryStorage) UpdateCluster

func (m *MemoryStorage) UpdateCluster(_ context.Context, req *UpdateClusterRequest) (*Cluster, error)

UpdateCluster updates an existing cluster.

type Option added in v0.6.0

type Option func(*MemoryStorage)

Option is a configuration option for MemoryStorage.

func WithDataDir added in v0.6.0

func WithDataDir(dir string) Option

WithDataDir enables persistent storage in the specified directory.

type ParameterGroup

type ParameterGroup struct {
	ARN         string `json:"ARN,omitempty"`
	Description string `json:"Description,omitempty"`
	Family      string `json:"Family,omitempty"`
	Name        string `json:"Name,omitempty"`
}

ParameterGroup represents a MemoryDB parameter group.

type SecurityGroupMembership

type SecurityGroupMembership struct {
	SecurityGroupID string `json:"SecurityGroupId,omitempty"`
	Status          string `json:"Status,omitempty"`
}

SecurityGroupMembership represents a security group association.

type Service

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

Service implements the AWS MemoryDB service.

func New

func New(storage Storage) *Service

New creates a new MemoryDB service.

func (*Service) Close added in v0.6.0

func (s *Service) Close() error

Close saves the storage state if persistence is enabled.

func (*Service) CreateACL

func (s *Service) CreateACL(w http.ResponseWriter, r *http.Request)

CreateACL handles the CreateACL API.

func (*Service) CreateCluster

func (s *Service) CreateCluster(w http.ResponseWriter, r *http.Request)

CreateCluster handles the CreateCluster API.

func (*Service) CreateUser

func (s *Service) CreateUser(w http.ResponseWriter, r *http.Request)

CreateUser handles the CreateUser API.

func (*Service) DeleteACL

func (s *Service) DeleteACL(w http.ResponseWriter, r *http.Request)

DeleteACL handles the DeleteACL API.

func (*Service) DeleteCluster

func (s *Service) DeleteCluster(w http.ResponseWriter, r *http.Request)

DeleteCluster handles the DeleteCluster API.

func (*Service) DeleteUser

func (s *Service) DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser handles the DeleteUser API.

func (*Service) DescribeACLs

func (s *Service) DescribeACLs(w http.ResponseWriter, r *http.Request)

DescribeACLs handles the DescribeACLs API.

func (*Service) DescribeClusters

func (s *Service) DescribeClusters(w http.ResponseWriter, r *http.Request)

DescribeClusters handles the DescribeClusters API.

func (*Service) DescribeUsers

func (s *Service) DescribeUsers(w http.ResponseWriter, r *http.Request)

DescribeUsers handles the DescribeUsers API.

func (*Service) DispatchAction

func (s *Service) DispatchAction(w http.ResponseWriter, r *http.Request)

DispatchAction dispatches the request to the appropriate handler.

func (*Service) JSONProtocol

func (s *Service) JSONProtocol()

JSONProtocol marks this service as using JSON protocol.

func (*Service) Name

func (s *Service) Name() string

Name returns the service name.

func (*Service) RegisterRoutes

func (s *Service) RegisterRoutes(_ service.Router)

RegisterRoutes registers the routes for this service.

func (*Service) TargetPrefix

func (s *Service) TargetPrefix() string

TargetPrefix returns the X-Amz-Target prefix for JSON protocol dispatch.

func (*Service) UpdateCluster

func (s *Service) UpdateCluster(w http.ResponseWriter, r *http.Request)

UpdateCluster handles the UpdateCluster API.

type ServiceError

type ServiceError struct {
	Code    string
	Message string
}

ServiceError represents a MemoryDB service error.

func (*ServiceError) Error

func (e *ServiceError) Error() string

type Snapshot

type Snapshot struct {
	ARN         string `json:"ARN,omitempty"`
	ClusterName string `json:"ClusterConfiguration.Name,omitempty"`
	KmsKeyID    string `json:"KmsKeyId,omitempty"`
	Name        string `json:"Name,omitempty"`
	Source      string `json:"Source,omitempty"`
	Status      string `json:"Status,omitempty"`
}

Snapshot represents a MemoryDB snapshot.

type Storage

type Storage interface {
	CreateCluster(ctx context.Context, req *CreateClusterRequest) (*Cluster, error)
	DescribeClusters(ctx context.Context, clusterName string) ([]Cluster, error)
	UpdateCluster(ctx context.Context, req *UpdateClusterRequest) (*Cluster, error)
	DeleteCluster(ctx context.Context, clusterName string) (*Cluster, error)

	CreateUser(ctx context.Context, req *CreateUserRequest) (*User, error)
	DescribeUsers(ctx context.Context, userName string) ([]User, error)
	DeleteUser(ctx context.Context, userName string) (*User, error)

	CreateACL(ctx context.Context, req *CreateACLRequest) (*ACL, error)
	DescribeACLs(ctx context.Context, aclName string) ([]ACL, error)
	DeleteACL(ctx context.Context, aclName string) (*ACL, error)
}

Storage defines the MemoryDB storage interface.

type SubnetGroup

type SubnetGroup struct {
	ARN         string   `json:"ARN,omitempty"`
	Description string   `json:"Description,omitempty"`
	Name        string   `json:"Name,omitempty"`
	SubnetIDs   []string `json:"Subnets,omitempty"`
	VpcID       string   `json:"VpcId,omitempty"`
}

SubnetGroup represents a MemoryDB subnet group.

type Tag

type Tag struct {
	Key   string `json:"Key"`
	Value string `json:"Value"`
}

Tag represents a key-value tag.

type UpdateClusterRequest

type UpdateClusterRequest struct {
	ClusterName            string   `json:"ClusterName"`
	ACLName                string   `json:"ACLName,omitempty"`
	Description            string   `json:"Description,omitempty"`
	EngineVersion          string   `json:"EngineVersion,omitempty"`
	MaintenanceWindow      string   `json:"MaintenanceWindow,omitempty"`
	NodeType               string   `json:"NodeType,omitempty"`
	ParameterGroupName     string   `json:"ParameterGroupName,omitempty"`
	SecurityGroupIDs       []string `json:"SecurityGroupIds,omitempty"`
	SnapshotRetentionLimit *int32   `json:"SnapshotRetentionLimit,omitempty"`
	SnapshotWindow         string   `json:"SnapshotWindow,omitempty"`
	SnsTopicArn            string   `json:"SnsTopicArn,omitempty"`
	SnsTopicStatus         string   `json:"SnsTopicStatus,omitempty"`
}

UpdateClusterRequest represents an UpdateCluster request.

type UpdateClusterResponse

type UpdateClusterResponse struct {
	Cluster *Cluster `json:"Cluster"`
}

UpdateClusterResponse represents an UpdateCluster response.

type User

type User struct {
	ACLNames             []string        `json:"ACLNames,omitempty"`
	ARN                  string          `json:"ARN,omitempty"`
	AccessString         string          `json:"AccessString,omitempty"`
	Authentication       *Authentication `json:"Authentication,omitempty"`
	MinimumEngineVersion string          `json:"MinimumEngineVersion,omitempty"`
	Name                 string          `json:"Name,omitempty"`
	Status               string          `json:"Status,omitempty"`
}

User represents a MemoryDB user.

Jump to

Keyboard shortcuts

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