ecluse
Safe HaskellNone
LanguageGHC2021

Ecluse.Config.QueueTarget

Description

Derive the mirror-queue backend from the queue URL's own shape.

The queue URL is the single source of truth for which backend carries the mirror jobs, the same derivation the mirror-write credential follows (Ecluse.Config.MirrorCredential): a real SQS queue URL (https://sqs.{region}.amazonaws.com/{account}/{queue}) names the SQS backend and carries its region in its host, and a Pub/Sub topic resource (projects/{project}/topics/{topic}) names the GCP backend and carries its project. Because the mechanism is parsed from the very destination it will serve, a backend/URL disagreement is unrepresentable rather than merely guarded, and no separate backend selector exists to disagree with the URL.

Synopsis

Documentation

data QueueTarget Source #

A recognised mirror-queue destination, parsed from the queue URL's shape.

Constructors

SqsTarget Text

An SQS queue URL; carries the region parsed from its host.

PubSubTarget Text Text

A Pub/Sub topic resource; carries its project and topic.

Instances

Instances details
Show QueueTarget Source # 
Instance details

Defined in Ecluse.Config.QueueTarget

Eq QueueTarget Source # 
Instance details

Defined in Ecluse.Config.QueueTarget

parseQueueTarget :: Text -> Maybe QueueTarget Source #

Parse a queue URL into the backend it names, or Nothing for a shape that names neither -- which the caller refuses loudly rather than guessing a backend. The SQS shape is validated in full, never classified on the host alone: exactly https://sqs.{region}.amazonaws.com/{account}/{queue} with a single-label region, a 12-digit account, one non-empty queue segment, and no query or fragment. The canonical form carries no port, so an explicit port -- :443 included -- is refused: a value that is nearly-but-not an SQS queue URL is a transcription error to surface, never to repair. The Pub/Sub shape is the whole value as a topic resource.