ecluse
Safe HaskellNone
LanguageGHC2021

Ecluse.Config.Parser

Description

Configuration key decoders with group-qualified refusal paths. Each declared key is read or explicitly accepted through unreadKey.

Synopsis

Group decoding

data GroupDecoder a Source #

An applicative group decoder: each key it declares is one it accepts and one it reads.

Instances

Instances details
Applicative GroupDecoder Source # 
Instance details

Defined in Ecluse.Config.Parser

Functor GroupDecoder Source # 
Instance details

Defined in Ecluse.Config.Parser

Methods

fmap :: (a -> b) -> GroupDecoder a -> GroupDecoder b #

(<$) :: a -> GroupDecoder b -> GroupDecoder a #

decodeGroup :: String -> GroupDecoder a -> KeyMap Value -> Parser a Source #

Refuse unknown keys before reading values. Refinement labels use noun.key.

decodeBareGroup :: String -> GroupDecoder a -> KeyMap Value -> Parser a Source #

Decode with bare refinement labels when the enclosing parser supplies the group context.

requiredKey :: FromJSON b => Key -> (String -> b -> Parser a) -> GroupDecoder a Source #

Decode and refine a required key. Refinements receive its group-qualified label.

optionalKey :: FromJSON b => Key -> (String -> b -> Parser a) -> GroupDecoder (Maybe a) Source #

requiredKey for an optional key: an absent or null one yields Nothing.

optionalKeyOr :: FromJSON b => Key -> b -> (String -> b -> Parser a) -> GroupDecoder a Source #

requiredKey for an optional key whose absence reads as fallback before parse sees it.

plainKey :: FromJSON a => Key -> GroupDecoder a Source #

A required key its own FromJSON instance decodes whole, with no further refusal.

optionalPlainKey :: FromJSON a => Key -> GroupDecoder (Maybe a) Source #

plainKey for an optional key.

optionalNonNullKey :: FromJSON a => Key -> GroupDecoder (Maybe a) Source #

optionalPlainKey for a key that refuses a written null, where an empty value must not read as the key's default.

nestedKey :: Key -> (KeyMap Value -> Parser a) -> GroupDecoder a Source #

Decode an absent group as an empty object so its required keys determine the refusal.

unreadKey :: Key -> GroupDecoder () Source #

A key the group accepts and no field reads.

Tagged targets

data TagCase a Source #

One tag a target key admits: the tag as an operator writes it, and the group under it.

Constructors

TagCase Key (GroupDecoder a) 

taggedTarget :: [TagCase a] -> String -> Value -> Parser a Source #

Admit exactly one store tag and only the keys its decoder declares.

Value shapes

expectString :: String -> (Text -> Parser a) -> Value -> Parser a Source #

Refuse a non-string with its setting label and JSON kind, without quoting its value.

commaSeparated :: String -> (Text -> Parser a) -> Value -> Parser [a] Source #

A blank string gives no entries. Empty comma-separated entries still reach parseEntry.

nonEmptyCommaSeparated :: String -> (Text -> Parser a) -> String -> Value -> Parser (NonEmpty a) Source #

Retain entry refusals before rejecting a configured list that names nothing.

projectedEntry :: String -> (Text -> Either e a) -> Text -> Parser a Source #

Read one list entry through a projection, refusing with the label and the quoted entry.

rejectSecretKeys :: KeyMap Value -> Parser () Source #

Refuse document credentials without including their values in the error.

Leaf parsers

parseRegistryUrl :: String -> Value -> Parser RegistryUrl Source #

Refuse credentials before any URL refusal can quote the input.

parseEnum :: (Text -> Either Text a) -> String -> Value -> Parser a Source #

Decode a named enum and retain the setting label on refusal.

parseHttpUrl :: String -> Value -> Parser Url Source #

Parse an HTTP(S) URL without credentials. Plain HTTP remains legal for loopback deployments.

parseQueueUrl :: String -> Value -> Parser QueueUrl Source #

Parse a queue destination whose shape determines its provider.

parseAdvisoryStoreUrl :: String -> Value -> Parser AdvisoryStoreUrl Source #

Parse an advisory object store whose scheme determines its provider.

parsePort :: String -> Int -> Parser Int Source #

A listener port: 0..65535, where 0 asks the OS for an ephemeral port.

parseCodeArtifactDuration :: String -> Value -> Parser Natural Source #

Accept seconds in CodeArtifact's 900..43200 range before the first token mint.