Documentation
¶
Overview ¶
Package redshift provides an in-memory mock of AWS Redshift. It implements relationaldb/driver.RelationalDB so the same backend serves both the portable API (relationaldb.DB) and the SDK-compat HTTP layer.
Redshift's primary unit is the cluster — there is no separate "instance" resource. Instance-level operations therefore return InvalidArgument with a hint to use the cluster ops; cluster lifecycle (Create/Modify/Delete/Reboot) and cluster snapshot/restore are first-class. The mock emits CloudWatch-shaped AWS/Redshift metrics on cluster lifecycle transitions to mirror real Redshift.
Index ¶
- type Mock
- func (m *Mock) CreateCluster(_ context.Context, cfg rdbdriver.ClusterConfig) (*rdbdriver.Cluster, error)
- func (m *Mock) CreateClusterSnapshot(_ context.Context, cfg rdbdriver.ClusterSnapshotConfig) (*rdbdriver.ClusterSnapshot, error)
- func (*Mock) CreateInstance(_ context.Context, _ rdbdriver.InstanceConfig) (*rdbdriver.Instance, error)
- func (*Mock) CreateSnapshot(_ context.Context, _ rdbdriver.SnapshotConfig) (*rdbdriver.Snapshot, error)
- func (m *Mock) DeleteCluster(_ context.Context, id string) error
- func (m *Mock) DeleteClusterSnapshot(_ context.Context, id string) error
- func (*Mock) DeleteInstance(_ context.Context, _ string) error
- func (*Mock) DeleteSnapshot(_ context.Context, _ string) error
- func (m *Mock) DescribeClusterSnapshots(_ context.Context, ids []string, clusterID string) ([]rdbdriver.ClusterSnapshot, error)
- func (m *Mock) DescribeClusters(_ context.Context, ids []string) ([]rdbdriver.Cluster, error)
- func (*Mock) DescribeInstances(_ context.Context, _ []string) ([]rdbdriver.Instance, error)
- func (*Mock) DescribeSnapshots(_ context.Context, _ []string, _ string) ([]rdbdriver.Snapshot, error)
- func (m *Mock) ModifyCluster(_ context.Context, id string, input rdbdriver.ModifyInstanceInput) (*rdbdriver.Cluster, error)
- func (*Mock) ModifyInstance(_ context.Context, _ string, _ rdbdriver.ModifyInstanceInput) (*rdbdriver.Instance, error)
- func (m *Mock) RebootCluster(_ context.Context, id string) error
- func (m *Mock) RebootInstance(ctx context.Context, id string) error
- func (m *Mock) RestoreClusterFromSnapshot(_ context.Context, input rdbdriver.RestoreClusterInput) (*rdbdriver.Cluster, error)
- func (*Mock) RestoreInstanceFromSnapshot(_ context.Context, _ rdbdriver.RestoreInstanceInput) (*rdbdriver.Instance, error)
- func (m *Mock) SetMonitoring(mon mondriver.Monitoring)
- func (m *Mock) StartCluster(_ context.Context, id string) error
- func (*Mock) StartInstance(_ context.Context, _ string) error
- func (m *Mock) StopCluster(_ context.Context, id string) error
- func (*Mock) StopInstance(_ context.Context, _ string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock is the in-memory AWS Redshift implementation.
func (*Mock) CreateCluster ¶
func (m *Mock) CreateCluster(_ context.Context, cfg rdbdriver.ClusterConfig) (*rdbdriver.Cluster, error)
CreateCluster creates a new Redshift cluster.
func (*Mock) CreateClusterSnapshot ¶
func (m *Mock) CreateClusterSnapshot( _ context.Context, cfg rdbdriver.ClusterSnapshotConfig, ) (*rdbdriver.ClusterSnapshot, error)
CreateClusterSnapshot snapshots a Redshift cluster.
func (*Mock) CreateInstance ¶
func (*Mock) CreateInstance(_ context.Context, _ rdbdriver.InstanceConfig) (*rdbdriver.Instance, error)
CreateInstance is unsupported in Redshift.
func (*Mock) CreateSnapshot ¶
func (*Mock) CreateSnapshot(_ context.Context, _ rdbdriver.SnapshotConfig) (*rdbdriver.Snapshot, error)
CreateSnapshot is unsupported — Redshift only has cluster snapshots.
func (*Mock) DeleteCluster ¶
DeleteCluster removes a cluster.
func (*Mock) DeleteClusterSnapshot ¶
DeleteClusterSnapshot removes a cluster snapshot.
func (*Mock) DeleteInstance ¶
DeleteInstance is unsupported in Redshift.
func (*Mock) DeleteSnapshot ¶
DeleteSnapshot is unsupported in Redshift.
func (*Mock) DescribeClusterSnapshots ¶
func (m *Mock) DescribeClusterSnapshots( _ context.Context, ids []string, clusterID string, ) ([]rdbdriver.ClusterSnapshot, error)
DescribeClusterSnapshots returns cluster snapshots filtered by ids and/or cluster.
func (*Mock) DescribeClusters ¶
DescribeClusters returns all clusters if ids is empty, else only matching ones.
func (*Mock) DescribeInstances ¶
DescribeInstances is unsupported in Redshift.
func (*Mock) DescribeSnapshots ¶
func (*Mock) DescribeSnapshots(_ context.Context, _ []string, _ string) ([]rdbdriver.Snapshot, error)
DescribeSnapshots is unsupported in Redshift.
func (*Mock) ModifyCluster ¶
func (m *Mock) ModifyCluster( _ context.Context, id string, input rdbdriver.ModifyInstanceInput, ) (*rdbdriver.Cluster, error)
ModifyCluster applies changes.
func (*Mock) ModifyInstance ¶
func (*Mock) ModifyInstance( _ context.Context, _ string, _ rdbdriver.ModifyInstanceInput, ) (*rdbdriver.Instance, error)
ModifyInstance is unsupported in Redshift.
func (*Mock) RebootCluster ¶
RebootCluster cycles a cluster — emits running-value metrics and leaves it available.
func (*Mock) RebootInstance ¶
RebootInstance delegates to RebootCluster — Redshift only has clusters, so a "reboot instance" call against a Redshift cluster ID is interpreted as a cluster reboot.
func (*Mock) RestoreClusterFromSnapshot ¶
func (m *Mock) RestoreClusterFromSnapshot( _ context.Context, input rdbdriver.RestoreClusterInput, ) (*rdbdriver.Cluster, error)
RestoreClusterFromSnapshot creates a new cluster from a cluster snapshot.
func (*Mock) RestoreInstanceFromSnapshot ¶
func (*Mock) RestoreInstanceFromSnapshot( _ context.Context, _ rdbdriver.RestoreInstanceInput, ) (*rdbdriver.Instance, error)
RestoreInstanceFromSnapshot is unsupported in Redshift.
func (*Mock) SetMonitoring ¶
func (m *Mock) SetMonitoring(mon mondriver.Monitoring)
SetMonitoring wires a CloudWatch-style backend for auto-metric emission.
func (*Mock) StartCluster ¶
StartCluster moves a paused cluster to available.
func (*Mock) StartInstance ¶
StartInstance is unsupported in Redshift.
func (*Mock) StopCluster ¶
StopCluster moves an available cluster to paused (mapped to "stopped" in the driver).