Documentation
¶
Overview ¶
Package rds provides emulation of Amazon RDS.
Implemented: CreateDBInstance, DescribeDBInstances, DeleteDBInstance, DescribeDBEngineVersions, StopDBInstance, StartDBInstance, ModifyDBInstance, CreateDBSubnetGroup, DeleteDBSubnetGroup, DescribeDBSubnetGroups, CreateDBParameterGroup, DeleteDBParameterGroup, DescribeDBParameterGroups, DescribeOrderableDBInstanceOptions. All other operations return HTTP 501 Not Implemented.
Index ¶
- type DBCluster
- type DBClusterMember
- type DBInstance
- type DBParameterGroup
- type DBSubnetGroup
- type Endpoint
- type Handler
- func (h *Handler) AddTagsToResource(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateDBCluster(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateDBClusterSnapshot(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateDBInstance(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateDBParameterGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateDBSnapshot(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateDBSubnetGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteDBCluster(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteDBClusterSnapshot(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteDBInstance(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteDBParameterGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteDBSnapshot(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteDBSubnetGroup(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeDBClusterSnapshots(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeDBClusters(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeDBEngineVersions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeDBInstances(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeDBLogFiles(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeDBParameterGroups(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeDBSnapshots(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeDBSubnetGroups(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DescribeOrderableDBInstanceOptions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DownloadDBLogFilePortion(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetInstanceLogs(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListTagsForResource(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ModifyDBCluster(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ModifyDBInstance(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RebootDBInstance(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RemoveTagsFromResource(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RestoreDBInstanceFromDBSnapshot(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StartDBCluster(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StartDBInstance(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StopDBCluster(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StopDBInstance(w http.ResponseWriter, r *http.Request)
- type Service
- func (s *Service) DispatchQuery(w http.ResponseWriter, r *http.Request)
- func (s *Service) InitBus(bus *events.Bus)
- func (s *Service) Name() string
- func (s *Service) Operations() []op.Operation
- func (s *Service) OwnsAction(action string) bool
- func (s *Service) OwnsVersion(version string) bool
- func (s *Service) ReconcileContainers(ctx context.Context, containers []docker.ContainerSummary)
- func (s *Service) RegisterRoutes(r chi.Router)
- func (s *Service) SetDocker(dc *docker.Client)
- func (s *Service) SetVPCResolver(r VPCNetworkResolver)
- func (s *Service) Stop(ctx context.Context)
- func (s *Service) SupportedProtocols() []codec.Codec
- type VPCNetworkResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBCluster ¶
type DBCluster struct {
DBClusterIdentifier string `json:"DBClusterIdentifier"`
DBClusterArn string `json:"DBClusterArn"`
Engine string `json:"Engine"`
EngineVersion string `json:"EngineVersion"`
Status string `json:"Status"`
MasterUsername string `json:"MasterUsername"`
DatabaseName string `json:"DatabaseName,omitempty"`
Port int `json:"Port"`
Endpoint string `json:"Endpoint,omitempty"`
ReaderEndpoint string `json:"ReaderEndpoint,omitempty"`
MultiAZ bool `json:"MultiAZ"`
StorageType string `json:"StorageType"`
ClusterCreateTime string `json:"ClusterCreateTime,omitempty"`
DBClusterMembers []DBClusterMember `json:"DBClusterMembers,omitempty"`
}
DBCluster represents a stored Aurora DB cluster.
type DBClusterMember ¶
type DBClusterMember struct {
DBInstanceIdentifier string `json:"DBInstanceIdentifier"`
IsClusterWriter bool `json:"IsClusterWriter"`
DBClusterParameterGroupStatus string `json:"DBClusterParameterGroupStatus"`
PromotionTier int `json:"PromotionTier"`
}
DBClusterMember represents one DB instance that belongs to an Aurora cluster.
type DBInstance ¶
type DBInstance struct {
DBInstanceIdentifier string `json:"DBInstanceIdentifier"`
DBInstanceClass string `json:"DBInstanceClass"`
Engine string `json:"Engine"`
EngineVersion string `json:"EngineVersion"`
DBInstanceStatus string `json:"DBInstanceStatus"`
MasterUsername string `json:"MasterUsername"`
MasterUserPassword string `json:"MasterUserPassword,omitempty"`
DBName string `json:"DBName,omitempty"`
AllocatedStorage int `json:"AllocatedStorage"`
Endpoint *Endpoint `json:"Endpoint,omitempty"`
DBInstanceArn string `json:"DBInstanceArn"`
InstanceCreateTime string `json:"InstanceCreateTime,omitempty"`
MultiAZ bool `json:"MultiAZ"`
StorageType string `json:"StorageType"`
Port int `json:"Port"`
DockerContainerID string `json:"DockerContainerID,omitempty"`
HostPort int `json:"HostPort,omitempty"`
DBClusterIdentifier string `json:"DBClusterIdentifier,omitempty"`
DBSubnetGroupName string `json:"DBSubnetGroupName,omitempty"`
VpcID string `json:"VpcId,omitempty"`
}
DBInstance represents a stored RDS DB instance.
type DBParameterGroup ¶
type DBParameterGroup struct {
DBParameterGroupName string `json:"dbParameterGroupName"`
DBParameterGroupFamily string `json:"dbParameterGroupFamily"`
Description string `json:"description"`
DBParameterGroupArn string `json:"dbParameterGroupArn"`
}
DBParameterGroup represents a stored RDS DB parameter group.
type DBSubnetGroup ¶
type DBSubnetGroup struct {
DBSubnetGroupName string `json:"DBSubnetGroupName"`
DBSubnetGroupDescription string `json:"DBSubnetGroupDescription"`
DBSubnetGroupArn string `json:"DBSubnetGroupArn"`
VpcId string `json:"VpcId"`
SubnetIds []string `json:"SubnetIds"`
Status string `json:"Status"`
}
DBSubnetGroup represents a stored RDS DB subnet group.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles RDS Query-protocol requests.
func (*Handler) AddTagsToResource ¶
func (h *Handler) AddTagsToResource(w http.ResponseWriter, r *http.Request)
AddTagsToResource adds metadata tags to an Amazon RDS resource.
func (*Handler) CreateDBCluster ¶
func (h *Handler) CreateDBCluster(w http.ResponseWriter, r *http.Request)
CreateDBCluster creates a new Aurora DB cluster. Only aurora-mysql and aurora-postgresql engines are accepted. The cluster is a logical resource — Docker containers are started when instances are added via CreateDBInstance.
func (*Handler) CreateDBClusterSnapshot ¶
func (h *Handler) CreateDBClusterSnapshot(w http.ResponseWriter, r *http.Request)
CreateDBClusterSnapshot creates a snapshot of an Aurora DB cluster.
func (*Handler) CreateDBInstance ¶
func (h *Handler) CreateDBInstance(w http.ResponseWriter, r *http.Request)
CreateDBInstance creates a new RDS DB instance (metadata-only).
func (*Handler) CreateDBParameterGroup ¶
func (h *Handler) CreateDBParameterGroup(w http.ResponseWriter, r *http.Request)
CreateDBParameterGroup creates a new DB parameter group.
func (*Handler) CreateDBSnapshot ¶
func (h *Handler) CreateDBSnapshot(w http.ResponseWriter, r *http.Request)
CreateDBSnapshot creates a snapshot of a DB instance.
func (*Handler) CreateDBSubnetGroup ¶
func (h *Handler) CreateDBSubnetGroup(w http.ResponseWriter, r *http.Request)
CreateDBSubnetGroup creates a new DB subnet group.
func (*Handler) DeleteDBCluster ¶
func (h *Handler) DeleteDBCluster(w http.ResponseWriter, r *http.Request)
DeleteDBCluster deletes an Aurora DB cluster. The cluster is marked "deleting" immediately and removed asynchronously. Member instances are not automatically deleted — callers should delete instances first (matching AWS behaviour).
func (*Handler) DeleteDBClusterSnapshot ¶
func (h *Handler) DeleteDBClusterSnapshot(w http.ResponseWriter, r *http.Request)
DeleteDBClusterSnapshot deletes a DB cluster snapshot.
func (*Handler) DeleteDBInstance ¶
func (h *Handler) DeleteDBInstance(w http.ResponseWriter, r *http.Request)
DeleteDBInstance deletes a DB instance. It immediately transitions to "deleting" (matching AWS behaviour), then asynchronously stops/removes the Docker container (if any) and removes the record from the store. All Docker cleanup steps are best-effort and fault-tolerant: a missing or already-stopped container will not block deletion.
func (*Handler) DeleteDBParameterGroup ¶
func (h *Handler) DeleteDBParameterGroup(w http.ResponseWriter, r *http.Request)
DeleteDBParameterGroup deletes a DB parameter group.
func (*Handler) DeleteDBSnapshot ¶
func (h *Handler) DeleteDBSnapshot(w http.ResponseWriter, r *http.Request)
DeleteDBSnapshot deletes a DB snapshot.
func (*Handler) DeleteDBSubnetGroup ¶
func (h *Handler) DeleteDBSubnetGroup(w http.ResponseWriter, r *http.Request)
DeleteDBSubnetGroup deletes a DB subnet group.
func (*Handler) DescribeDBClusterSnapshots ¶
func (h *Handler) DescribeDBClusterSnapshots(w http.ResponseWriter, r *http.Request)
DescribeDBClusterSnapshots returns information about DB cluster snapshots.
func (*Handler) DescribeDBClusters ¶
func (h *Handler) DescribeDBClusters(w http.ResponseWriter, r *http.Request)
DescribeDBClusters returns Aurora DB clusters, optionally filtered by identifier.
func (*Handler) DescribeDBEngineVersions ¶
func (h *Handler) DescribeDBEngineVersions(w http.ResponseWriter, r *http.Request)
DescribeDBEngineVersions returns the supported engine versions.
func (*Handler) DescribeDBInstances ¶
func (h *Handler) DescribeDBInstances(w http.ResponseWriter, r *http.Request)
DescribeDBInstances returns DB instances, optionally filtered by identifier.
func (*Handler) DescribeDBLogFiles ¶
func (h *Handler) DescribeDBLogFiles(w http.ResponseWriter, r *http.Request)
DescribeDBLogFiles returns a list of DB log files for the DB instance.
func (*Handler) DescribeDBParameterGroups ¶
func (h *Handler) DescribeDBParameterGroups(w http.ResponseWriter, r *http.Request)
DescribeDBParameterGroups returns DB parameter groups, optionally filtered by name.
func (*Handler) DescribeDBSnapshots ¶
func (h *Handler) DescribeDBSnapshots(w http.ResponseWriter, r *http.Request)
DescribeDBSnapshots returns information about DB snapshots.
func (*Handler) DescribeDBSubnetGroups ¶
func (h *Handler) DescribeDBSubnetGroups(w http.ResponseWriter, r *http.Request)
DescribeDBSubnetGroups returns DB subnet groups, optionally filtered by name.
func (*Handler) DescribeOrderableDBInstanceOptions ¶
func (h *Handler) DescribeOrderableDBInstanceOptions(w http.ResponseWriter, r *http.Request)
DescribeOrderableDBInstanceOptions returns static orderable instance options.
func (*Handler) DownloadDBLogFilePortion ¶
func (h *Handler) DownloadDBLogFilePortion(w http.ResponseWriter, r *http.Request)
DownloadDBLogFilePortion downloads all or a portion of a specified log file.
func (*Handler) GetInstanceLogs ¶
func (h *Handler) GetInstanceLogs(w http.ResponseWriter, r *http.Request)
GetInstanceLogs returns the last 200 lines of logs for an RDS instance's Docker container. This is an emulator-only endpoint.
func (*Handler) ListTagsForResource ¶
func (h *Handler) ListTagsForResource(w http.ResponseWriter, r *http.Request)
ListTagsForResource lists all tags on an Amazon RDS resource.
func (*Handler) ModifyDBCluster ¶
func (h *Handler) ModifyDBCluster(w http.ResponseWriter, r *http.Request)
ModifyDBCluster updates settings on an Aurora DB cluster.
func (*Handler) ModifyDBInstance ¶
func (h *Handler) ModifyDBInstance(w http.ResponseWriter, r *http.Request)
ModifyDBInstance modifies metadata properties of an existing DB instance.
func (*Handler) RebootDBInstance ¶
func (h *Handler) RebootDBInstance(w http.ResponseWriter, r *http.Request)
RebootDBInstance reboots a DB instance.
func (*Handler) RemoveTagsFromResource ¶
func (h *Handler) RemoveTagsFromResource(w http.ResponseWriter, r *http.Request)
RemoveTagsFromResource removes metadata tags from an Amazon RDS resource.
func (*Handler) RestoreDBInstanceFromDBSnapshot ¶
func (h *Handler) RestoreDBInstanceFromDBSnapshot(w http.ResponseWriter, r *http.Request)
RestoreDBInstanceFromDBSnapshot restores a DB instance from a snapshot.
func (*Handler) StartDBCluster ¶
func (h *Handler) StartDBCluster(w http.ResponseWriter, r *http.Request)
StartDBCluster starts a stopped Aurora DB cluster.
func (*Handler) StartDBInstance ¶
func (h *Handler) StartDBInstance(w http.ResponseWriter, r *http.Request)
StartDBInstance starts a previously stopped DB instance.
func (*Handler) StopDBCluster ¶
func (h *Handler) StopDBCluster(w http.ResponseWriter, r *http.Request)
StopDBCluster stops a running Aurora DB cluster.
func (*Handler) StopDBInstance ¶
func (h *Handler) StopDBInstance(w http.ResponseWriter, r *http.Request)
StopDBInstance stops a running DB instance.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements router.Service and router.QueryDispatcher for RDS. Uses the AWS Query protocol (form-encoded POST, XML responses) and identifies itself by the API version "2014-10-31".
func (*Service) DispatchQuery ¶
func (s *Service) DispatchQuery(w http.ResponseWriter, r *http.Request)
DispatchQuery satisfies router.QueryDispatcher; routes to the correct handler.
func (*Service) InitBus ¶
InitBus wires the event bus for RDS lifecycle events and subscribes to Docker container events so instance status stays in sync with container state.
func (*Service) Operations ¶
Operations implements router.ProtocolService.
func (*Service) OwnsAction ¶
OwnsAction satisfies router.QueryActionOwner.
func (*Service) OwnsVersion ¶
OwnsVersion satisfies router.QueryVersionOwner.
func (*Service) ReconcileContainers ¶
func (s *Service) ReconcileContainers(ctx context.Context, containers []docker.ContainerSummary)
ReconcileContainers satisfies router.ContainerReconciler. It is called once after Docker becomes available at startup and syncs stored RDS instance statuses against the actual container state.
func (*Service) RegisterRoutes ¶
RegisterRoutes satisfies router.Service. Registers emulator-only endpoints.
func (*Service) SetDocker ¶
SetDocker wires the Docker client for RDS container management and starts the DockGC background remove loop.
func (*Service) SetVPCResolver ¶
func (s *Service) SetVPCResolver(r VPCNetworkResolver)
SetVPCResolver wires the EC2 VPC resolver for DB subnet group launches.
func (*Service) Stop ¶
Stop cancels pending lifecycle transitions and cleans up Docker containers via the GC. The GC does a Docker-level sweep so even orphaned containers (whose store record was already deleted) are caught and removed.
func (*Service) SupportedProtocols ¶
SupportedProtocols implements router.ProtocolService.
type VPCNetworkResolver ¶
type VPCNetworkResolver interface {
VpcIDForSubnet(ctx context.Context, subnetID string) string
VPCNetworkStatus(ctx context.Context, vpcID string) string
DockerNetworkForVpc(ctx context.Context, vpcID string) string
}
VPCNetworkResolver resolves DB subnet groups back to EC2 VPC network state.