dsql

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 26 Imported by: 0

README

Dsql

Parity grade: A · SDK aws-sdk-go-v2/service/dsql@v1.22.1 · last audited 2026-10-05 (5bb0d02ee)

Coverage

Metric Value
PARITY entries audited 16 (16 ok)
Feature families 4 (4 ok)
Known gaps none
Structural gaps (can't be emulated) 3
Deferred items 0
Resource leaks clean
Structural gaps

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • No PostgreSQL data plane: a cluster's .dsql..on.aws endpoint is wire-shaped but nothing listens, so SQL cannot be run. Authentication tokens (the SDK's feature/dsql/auth GenerateDbConnectAuthToken) are client-side SigV4 presigns, not an API operation, and need no server support.
  • bypassPolicyLockoutSafetyCheck (CreateCluster, PutClusterPolicy) is accepted but not evaluated: the lockout check asks whether the calling principal keeps access, and the emulator has no authenticated caller identity or IAM policy evaluation (same stance as services/kms).
  • GetVpcEndpointServiceName returns wire-shaped names only: there is no PrivateLink / VPC endpoint plane to back them.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClusterNotFound is returned when a cluster identifier does not exist.
	ErrClusterNotFound = awserr.New("cluster not found", awserr.ErrNotFound)
	// ErrStreamNotFound is returned when a stream identifier does not exist.
	ErrStreamNotFound = awserr.New("stream not found", awserr.ErrNotFound)
	// ErrPolicyNotFound is returned when a cluster has no resource policy set.
	ErrPolicyNotFound = awserr.New("cluster policy not found", awserr.ErrNotFound)
	// ErrDeletionProtected is returned when DeleteCluster is called on a
	// cluster with deletionProtectionEnabled set.
	ErrDeletionProtected = awserr.New("cluster has deletion protection enabled", awserr.ErrInvalidParameter)
	// ErrValidation is returned when request input fails validation.
	ErrValidation = awserr.New("invalid argument", awserr.ErrInvalidParameter)
	// ErrPolicyVersionMismatch is returned when an expectedPolicyVersion does
	// not match the cluster's current policy version.
	ErrPolicyVersionMismatch = awserr.New("policy version mismatch", awserr.ErrConflict)
	// ErrClusterQuotaExceeded is returned when an account/region would exceed
	// the emulated per-region cluster quota.
	ErrClusterQuotaExceeded = errors.New("cluster quota exceeded")
	// ErrStreamQuotaExceeded is returned when a cluster would exceed the
	// emulated per-cluster stream quota.
	ErrStreamQuotaExceeded = errors.New("stream quota exceeded")
)
View Source
var ErrNoSnapshot = errors.New("backend does not support restore")

ErrNoSnapshot is returned when a backend does not support snapshot/restore.

View Source
var ErrTokenReused = awserr.New("client token was already used with different parameters", awserr.ErrConflict)

ErrTokenReused is a clientToken reused with different parameters; the SDK declares only ConflictException for it.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	CreationTime              time.Time
	PendingUntil              time.Time
	Policy                    *ClusterPolicy
	MultiRegion               *MultiRegionProperties
	Tags                      map[string]string
	Identifier                string
	ARN                       string
	Endpoint                  string
	Status                    string
	KmsEncryptionKey          string
	AccountID                 string
	Region                    string
	DeletionProtectionEnabled bool
}

Cluster is the persisted representation of an Aurora DSQL cluster.

type ClusterPolicy

type ClusterPolicy struct {
	Policy  string
	Version string
}

ClusterPolicy is a resource-based policy attached to a cluster.

type CreateClusterInput

type CreateClusterInput struct {
	MultiRegion               *MultiRegionProperties
	Tags                      map[string]string
	Policy                    string
	KmsEncryptionKey          string
	DeletionProtectionEnabled bool
}

CreateClusterInput carries CreateCluster's optional fields.

type CreateStreamInput

type CreateStreamInput struct {
	Target   *StreamTarget
	Tags     map[string]string
	Format   string
	Ordering string
}

CreateStreamInput carries CreateStream's fields.

type Handler

type Handler struct {
	Backend StorageBackend

	AccountID     string
	DefaultRegion string
	// contains filtered or unexported fields
}

Handler is the HTTP handler for the Aurora DSQL REST-JSON control-plane API.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a new Aurora DSQL handler backed by backend.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this handler handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the operation name from the request.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts the resource identifier from the request.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for Aurora DSQL requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all backend state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence by delegating to the backend if it supports it.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches Aurora DSQL REST API requests.

/tags/{arn} is SigV4-scoped rather than claimed unconditionally: it is a generic-tagging path many restjson1 services reuse verbatim (see .claude/memories/route-matcher-prefix-collision.md), so an unscoped claim here would swallow another service's own TagResource/UntagResource/ ListTagsForResource requests.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence by delegating to the backend if it supports it.

type InMemoryBackend

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

InMemoryBackend is the in-memory implementation of StorageBackend.

func NewInMemoryBackend

func NewInMemoryBackend() *InMemoryBackend

NewInMemoryBackend creates a new in-memory Aurora DSQL backend.

func (*InMemoryBackend) CreateCluster

func (b *InMemoryBackend) CreateCluster(accountID, region string, in CreateClusterInput) (*Cluster, error)

CreateCluster creates a new Aurora DSQL cluster. New clusters start CREATING and lazily transition to ACTIVE on the next read once clusterActivationDelay elapses -- see PARITY.md for why this is a lazy deadline rather than a background reconciler.

func (*InMemoryBackend) CreateStream

func (b *InMemoryBackend) CreateStream(clusterIdentifier string, in CreateStreamInput) (*Stream, error)

CreateStream creates a Kinesis change-data-capture stream on a cluster. New streams start CREATING and lazily transition to ACTIVE on the next read once streamActivationDelay elapses.

func (*InMemoryBackend) DeleteCluster

func (b *InMemoryBackend) DeleteCluster(identifier string) (*Cluster, error)

DeleteCluster marks a cluster DELETING; it is lazily removed from the table clusterDeletionDelay after this call, on the next resolve. A cluster with deletion protection enabled cannot be deleted.

func (*InMemoryBackend) DeleteClusterPolicy

func (b *InMemoryBackend) DeleteClusterPolicy(identifier, expectedVersion string) (*ClusterPolicy, error)

DeleteClusterPolicy removes a cluster's resource-based policy. If expectedVersion is non-empty it must match the current policy version.

func (*InMemoryBackend) DeleteStream

func (b *InMemoryBackend) DeleteStream(clusterIdentifier, streamIdentifier string) (*Stream, error)

DeleteStream marks a stream DELETING; it is lazily removed streamDeletionDelay later, on the next read.

func (*InMemoryBackend) GetCluster

func (b *InMemoryBackend) GetCluster(identifier string) (*Cluster, error)

GetCluster returns the current information about a cluster.

func (*InMemoryBackend) GetClusterPolicy

func (b *InMemoryBackend) GetClusterPolicy(identifier string) (*ClusterPolicy, error)

GetClusterPolicy returns a cluster's resource-based policy.

func (*InMemoryBackend) GetStream

func (b *InMemoryBackend) GetStream(clusterIdentifier, streamIdentifier string) (*Stream, error)

GetStream returns the current information about a stream.

func (*InMemoryBackend) GetVpcEndpointServiceName

func (b *InMemoryBackend) GetVpcEndpointServiceName(identifier, region string) (string, string, error)

GetVpcEndpointServiceName returns the VPC endpoint service name and cluster-specific VPC endpoint DNS name a client would use to reach the cluster privately. There is no real VPC/PrivateLink plane behind this emulator, so both values are wire-shaped but not backed by a functioning endpoint -- see PARITY.md.

func (*InMemoryBackend) ListClusters

func (b *InMemoryBackend) ListClusters(nextToken string, maxResults int) ([]*Cluster, string, error)

ListClusters returns clusters ordered by identifier, paginated by nextToken/maxResults.

func (*InMemoryBackend) ListStreams

func (b *InMemoryBackend) ListStreams(clusterIdentifier, nextToken string, maxResults int) ([]*Stream, string, error)

ListStreams returns a cluster's streams ordered by stream identifier, paginated by nextToken/maxResults.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)

ListTagsForResource returns all tags on a cluster.

func (*InMemoryBackend) PutClusterPolicy

func (b *InMemoryBackend) PutClusterPolicy(identifier, policy, expectedVersion string) (*ClusterPolicy, error)

PutClusterPolicy creates or replaces a cluster's resource-based policy. If expectedVersion is non-empty it must match the current policy version (optimistic concurrency), matching PutClusterPolicyInput's expectedPolicyVersion semantics.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all backend state.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore deserializes backend state from a JSON snapshot.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serializes backend state to JSON.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error

TagResource adds or replaces tags on a cluster identified by its ARN.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error

UntagResource removes tags from a cluster by key.

func (*InMemoryBackend) UpdateCluster

func (b *InMemoryBackend) UpdateCluster(identifier string, in UpdateClusterInput) (*Cluster, error)

UpdateCluster updates a cluster's mutable configuration and transitions it through UPDATING back to ACTIVE on the next read.

type MultiRegionProperties

type MultiRegionProperties struct {
	WitnessRegion string
	Clusters      []string
}

MultiRegionProperties mirrors types.MultiRegionProperties.

type Provider

type Provider struct{}

Provider implements service.Provider for the Aurora DSQL service.

func (*Provider) Init

Init initializes the Aurora DSQL service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type Snapshottable

type Snapshottable interface {
	Snapshot(ctx context.Context) []byte
	Restore(context.Context, []byte) error
}

Snapshottable is an optional interface a StorageBackend may implement to support snapshot/restore for persistence or test isolation.

type StorageBackend

type StorageBackend interface {
	CreateCluster(accountID, region string, in CreateClusterInput) (*Cluster, error)
	GetCluster(identifier string) (*Cluster, error)
	ListClusters(nextToken string, maxResults int) ([]*Cluster, string, error)
	UpdateCluster(identifier string, in UpdateClusterInput) (*Cluster, error)
	DeleteCluster(identifier string) (*Cluster, error)

	GetClusterPolicy(identifier string) (*ClusterPolicy, error)
	PutClusterPolicy(identifier, policy, expectedVersion string) (*ClusterPolicy, error)
	DeleteClusterPolicy(identifier, expectedVersion string) (*ClusterPolicy, error)

	GetVpcEndpointServiceName(identifier, region string) (serviceName, clusterVpcEndpoint string, err error)

	CreateStream(clusterIdentifier string, in CreateStreamInput) (*Stream, error)
	GetStream(clusterIdentifier, streamIdentifier string) (*Stream, error)
	DeleteStream(clusterIdentifier, streamIdentifier string) (*Stream, error)
	ListStreams(clusterIdentifier, nextToken string, maxResults int) ([]*Stream, string, error)

	TagResource(resourceARN string, tags map[string]string) error
	UntagResource(resourceARN string, tagKeys []string) error
	ListTagsForResource(resourceARN string) (map[string]string, error)

	Reset()
}

StorageBackend is the interface for the Aurora DSQL backend.

type Stream

type Stream struct {
	CreationTime      time.Time
	PendingUntil      time.Time
	Target            *StreamTarget
	Tags              map[string]string
	ClusterIdentifier string
	StreamIdentifier  string
	ARN               string
	Status            string
	Format            string
	Ordering          string
}

Stream is the persisted representation of an Aurora DSQL change-data-capture stream.

type StreamTarget

type StreamTarget struct {
	RoleArn   string
	StreamArn string
}

StreamTarget mirrors types.TargetDefinitionMemberKinesis.

type UpdateClusterInput

type UpdateClusterInput struct {
	MultiRegion               *MultiRegionProperties
	DeletionProtectionEnabled *bool
	KmsEncryptionKey          string
}

UpdateClusterInput carries UpdateCluster's optional fields. A nil pointer means "leave unchanged"; KmsEncryptionKey uses the empty string to mean "unchanged" and the reserved value "AWS_OWNED_KMS_KEY" to mean "revert to the AWS owned key", matching the real API's documented semantics.

Jump to

Keyboard shortcuts

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