mysqlflex

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package mysqlflex provides an in-memory mock of Azure Database for MySQL — Flexible Server. It implements relationaldb/driver.RelationalDB so the same backend serves both the portable API (relationaldb.DB) and the SDK-compat HTTP layer (server/azure/mysqlflex).

MySQL Flexible Server is flat: a flexibleServer maps directly to a database "instance"; there is no Aurora-style cluster. Cluster methods on the driver interface return InvalidArgument. Snapshots are exposed as portable-only synthetic backups (Azure surfaces backups via the dataprotection RP, not flexibleServers itself); ClusterSnapshot ops are unsupported.

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 Azure MySQL Flexible Server implementation.

func New

func New(opts *config.Options) *Mock

New creates a new MySQL Flexible Server mock.

func (*Mock) CreateCluster

func (*Mock) CreateCluster(_ context.Context, _ rdsdriver.ClusterConfig) (*rdsdriver.Cluster, error)

CreateCluster is unsupported on MySQL Flexible Server.

func (*Mock) CreateClusterSnapshot

func (*Mock) CreateClusterSnapshot(
	_ context.Context, _ rdsdriver.ClusterSnapshotConfig,
) (*rdsdriver.ClusterSnapshot, error)

CreateClusterSnapshot is unsupported on MySQL Flexible Server.

func (*Mock) CreateInstance

func (m *Mock) CreateInstance(_ context.Context, cfg rdsdriver.InstanceConfig) (*rdsdriver.Instance, error)

CreateInstance creates a new MySQL Flexible Server.

func (*Mock) CreateSnapshot

func (m *Mock) CreateSnapshot(_ context.Context, cfg rdsdriver.SnapshotConfig) (*rdsdriver.Snapshot, error)

CreateSnapshot creates a portable-only synthetic backup. Azure exposes MySQL Flex backups via Microsoft.DataProtection — not flexibleServers itself — so the SDK-compat handler does not surface this op. Portable callers can still drive backups through relationaldb.DB.

func (*Mock) DeleteCluster

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

DeleteCluster is unsupported on MySQL Flexible Server.

func (*Mock) DeleteClusterSnapshot

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

DeleteClusterSnapshot is unsupported on MySQL Flexible Server.

func (*Mock) DeleteInstance

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

DeleteInstance removes a server.

func (*Mock) DeleteSnapshot

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

DeleteSnapshot removes a portable backup.

func (*Mock) DescribeClusterSnapshots

func (*Mock) DescribeClusterSnapshots(
	_ context.Context, _ []string, _ string,
) ([]rdsdriver.ClusterSnapshot, error)

DescribeClusterSnapshots returns an empty list — Flex MySQL has no clusters.

func (*Mock) DescribeClusters

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

DescribeClusters returns an empty list — Flex MySQL has no clusters.

func (*Mock) DescribeInstances

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

DescribeInstances returns all instances if ids is empty, else only matching ones.

func (*Mock) DescribeSnapshots

func (m *Mock) DescribeSnapshots(
	_ context.Context, ids []string, instanceID string,
) ([]rdsdriver.Snapshot, error)

DescribeSnapshots returns snapshots filtered by ids and/or instance.

func (*Mock) ModifyCluster

ModifyCluster is unsupported on MySQL Flexible Server.

func (*Mock) ModifyInstance

func (m *Mock) ModifyInstance(
	_ context.Context, id string, input rdsdriver.ModifyInstanceInput,
) (*rdsdriver.Instance, error)

ModifyInstance applies the supplied changes.

func (*Mock) RebootInstance

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

RebootInstance restarts a running server.

func (*Mock) RestoreClusterFromSnapshot

func (*Mock) RestoreClusterFromSnapshot(
	_ context.Context, _ rdsdriver.RestoreClusterInput,
) (*rdsdriver.Cluster, error)

RestoreClusterFromSnapshot is unsupported on MySQL Flexible Server.

func (*Mock) RestoreInstanceFromSnapshot

func (m *Mock) RestoreInstanceFromSnapshot(
	_ context.Context, input rdsdriver.RestoreInstanceInput,
) (*rdsdriver.Instance, error)

RestoreInstanceFromSnapshot creates a new server from a portable backup.

func (*Mock) SetMonitoring

func (m *Mock) SetMonitoring(mon mondriver.Monitoring)

SetMonitoring wires an Azure Monitor backend for auto-metric emission.

func (*Mock) StartCluster

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

StartCluster is unsupported on MySQL Flexible Server.

func (*Mock) StartInstance

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

StartInstance moves a stopped server back to runnable.

func (*Mock) StopCluster

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

StopCluster is unsupported on MySQL Flexible Server.

func (*Mock) StopInstance

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

StopInstance moves a runnable server to stopped.

Jump to

Keyboard shortcuts

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