redshift

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 9 Imported by: 0

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

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 New

func New(opts *config.Options) *Mock

New creates a new AWS Redshift mock.

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

func (m *Mock) DeleteCluster(_ context.Context, id string) error

DeleteCluster removes a cluster.

func (*Mock) DeleteClusterSnapshot

func (m *Mock) DeleteClusterSnapshot(_ context.Context, id string) error

DeleteClusterSnapshot removes a cluster snapshot.

func (*Mock) DeleteInstance

func (*Mock) DeleteInstance(_ context.Context, _ string) error

DeleteInstance is unsupported in Redshift.

func (*Mock) DeleteSnapshot

func (*Mock) DeleteSnapshot(_ context.Context, _ string) error

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

func (m *Mock) DescribeClusters(_ context.Context, ids []string) ([]rdbdriver.Cluster, error)

DescribeClusters returns all clusters if ids is empty, else only matching ones.

func (*Mock) DescribeInstances

func (*Mock) DescribeInstances(_ context.Context, _ []string) ([]rdbdriver.Instance, error)

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

ModifyInstance is unsupported in Redshift.

func (*Mock) RebootCluster

func (m *Mock) RebootCluster(_ context.Context, id string) error

RebootCluster cycles a cluster — emits running-value metrics and leaves it available.

func (*Mock) RebootInstance

func (m *Mock) RebootInstance(ctx context.Context, id string) error

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

func (m *Mock) StartCluster(_ context.Context, id string) error

StartCluster moves a paused cluster to available.

func (*Mock) StartInstance

func (*Mock) StartInstance(_ context.Context, _ string) error

StartInstance is unsupported in Redshift.

func (*Mock) StopCluster

func (m *Mock) StopCluster(_ context.Context, id string) error

StopCluster moves an available cluster to paused (mapped to "stopped" in the driver).

func (*Mock) StopInstance

func (*Mock) StopInstance(_ context.Context, _ string) error

StopInstance is unsupported in Redshift.

Jump to

Keyboard shortcuts

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