aws-0.16: Amazon Web Services (AWS) for Haskell

Copyright | Soostone Inc Chris Allen
License | BSD3
Maintainer | Ozgun Ataman <ozgun.ataman@soostone.com>
Stability | experimental
Safe Haskell | None
Language | Haskell2010

Aws.DynamoDb.Core

Contents

- Configuration and Regions
- DynamoDB values
- Converting to/from `DValue`
- Defining new `DynVal` instances
- Working with key/value pairs
- Working with objects (attribute collections)
- Common types used by operations
- Size estimation
- Responses & Errors
- Internal Helpers

Description

Shared types and utilities for DyanmoDb functionality.

Synopsis

- data Region = Region {
  - rUri :: ByteString
  - rName :: ByteString
  }
- ddbLocal :: Region
- ddbUsEast1 :: Region
- ddbUsWest1 :: Region
- ddbUsWest2 :: Region
- ddbEuWest1 :: Region
- ddbEuCentral1 :: Region
- ddbApNe1 :: Region
- ddbApSe1 :: Region
- ddbApSe2 :: Region
- ddbSaEast1 :: Region
- data DdbConfiguration qt = DdbConfiguration {
  - ddbcRegion :: Region
  - ddbcProtocol :: Protocol
  - ddbcPort :: Maybe Int
  }
- data DValue
  - = DNull
  - | DNum Scientific
  - | DString Text
  - | DBinary ByteString
  - | DNumSet (Set Scientific)
  - | DStringSet (Set Text)
  - | DBinSet (Set ByteString)
  - | DBool Bool
  - | DBoolSet (Set Bool)
  - | DList (Vector DValue)
  - | DMap (Map Text DValue)
- class DynData (DynRep a) => DynVal a where
  - type DynRep a
- toValue :: DynVal a => a -> DValue
- fromValue :: DynVal a => DValue -> Maybe a
- newtype Bin a = Bin {
  - getBin :: a
  }
- newtype OldBool = OldBool Bool
- class Ord a => DynData a where
- newtype DynBinary = DynBinary {
  - unDynBinary :: ByteString
  }
- newtype DynNumber = DynNumber {
  - unDynNumber :: Scientific
  }
- newtype DynString = DynString {
  - unDynString :: Text
  }
- newtype DynBool = DynBool {
  - unDynBool :: Bool
  }
- data Attribute = Attribute {
  - attrName :: Text
  - attrVal :: DValue
  }
- parseAttributeJson :: Value -> Parser [Attribute]
- attributeJson :: Attribute -> Pair
- attributesJson :: [Attribute] -> Value
- attrTuple :: Attribute -> (Text, DValue)
- attr :: DynVal a => Text -> a -> Attribute
- attrAs :: DynVal a => Proxy a -> Text -> a -> Attribute
- text :: Proxy Text
- int :: Proxy Integer
- double :: Proxy Double
- data PrimaryKey = PrimaryKey {
  - pkHash :: Attribute
  - pkRange :: Maybe Attribute
  }
- hk :: Text -> DValue -> PrimaryKey
- hrk :: Text -> DValue -> Text -> DValue -> PrimaryKey
- type Item = Map Text DValue
- item :: [Attribute] -> Item
- attributes :: Map Text DValue -> [Attribute]
- class ToDynItem a where
- class FromDynItem a where
- fromItem :: FromDynItem a => Item -> Either String a
- newtype Parser a = Parser {
  - runParser :: forall f r. Failure f r -> Success a f r -> f r
  }
- getAttr :: forall a. (Typeable a, DynVal a) => Text -> Item -> Parser a
- getAttr' :: forall a. DynVal a => Text -> Item -> Parser (Maybe a)
- parseAttr :: FromDynItem a => Text -> Item -> Parser a
- data Conditions = Conditions CondMerge [Condition]
- conditionsJson :: Text -> Conditions -> [Pair]
- expectsJson :: Conditions -> [Pair]
- data Condition = Condition {
  - condAttr :: Text
  - condOp :: CondOp
  }
- conditionJson :: Condition -> Pair
- data CondOp
  - = DEq DValue
  - | NotEq DValue
  - | DLE DValue
  - | DLT DValue
  - | DGE DValue
  - | DGT DValue
  - | NotNull
  - | IsNull
  - | Contains DValue
  - | NotContains DValue
  - | Begins DValue
  - | In [DValue]
  - | Between DValue DValue
- data CondMerge
  - = CondAnd
  - | CondOr
- data ConsumedCapacity = ConsumedCapacity {
  - capacityUnits :: Int64
  - capacityGlobalIndex :: [(Text, Int64)]
  - capacityLocalIndex :: [(Text, Int64)]
  - capacityTableUnits :: Maybe Int64
  - capacityTable :: Text
  }
- data ReturnConsumption
  - = RCIndexes
  - | RCTotal
  - | RCNone
- data ItemCollectionMetrics = ItemCollectionMetrics {
  - icmKey :: (Text, DValue)
  - icmEstimate :: [Double]
  }
- data ReturnItemCollectionMetrics
  - = RICMSize
  - | RICMNone
- data UpdateReturn
  - = URNone
  - | URAllOld
  - | URUpdatedOld
  - | URAllNew
  - | URUpdatedNew
- data QuerySelect
  - = SelectSpecific [Text]
  - | SelectCount
  - | SelectProjected
  - | SelectAll
- querySelectJson :: KeyValue t => QuerySelect -> [t]
- class DynSize a where
- nullAttr :: Attribute -> Bool
- data DdbResponse = DdbResponse {
  - ddbrCrc :: Maybe Text
  - ddbrMsgId :: Maybe Text
  }
- data DdbErrCode
  - = AccessDeniedException
  - | ConditionalCheckFailedException
  - | IncompleteSignatureException
  - | InvalidSignatureException
  - | LimitExceededException
  - | MissingAuthenticationTokenException
  - | ProvisionedThroughputExceededException
  - | ResourceInUseException
  - | ResourceNotFoundException
  - | ThrottlingException
  - | ValidationException
  - | RequestTooLarge
  - | InternalFailure
  - | InternalServerError
  - | ServiceUnavailableException
  - | SerializationException
- shouldRetry :: DdbErrCode -> Bool
- data DdbError = DdbError {
  - ddbStatusCode :: Int
  - ddbErrCode :: DdbErrCode
  - ddbErrMsg :: Text
  }
- ddbSignQuery :: ToJSON a => ByteString -> a -> DdbConfiguration qt -> SignatureData -> SignedQuery
- data AmazonError = AmazonError {
  - aeType :: Text
  - aeMessage :: Maybe Text
  }
- ddbResponseConsumer :: FromJSON a => IORef DdbResponse -> HTTPResponseConsumer a
- ddbHttp :: Region -> DdbConfiguration NormalQuery
- ddbHttps :: Region -> DdbConfiguration NormalQuery

# Configuration and Regions

data Region #

Constructors

Region |
Fields rUri :: ByteString rName :: ByteString

Instances

Eq Region # |
Methods (==) :: Region -> Region -> Bool # (/=) :: Region -> Region -> Bool #
Read Region # |
Methods readsPrec :: Int -> ReadS Region # readList :: ReadS [Region] # readPrec :: ReadPrec Region # readListPrec :: ReadPrec [Region] #
Show Region # |
Methods showsPrec :: Int -> Region -> ShowS # show :: Region -> String # showList :: [Region] -> ShowS #

ddbLocal :: Region #

DynamoDb local connection (for development)

ddbUsEast1 :: Region #

ddbUsWest1 :: Region #

ddbUsWest2 :: Region #

ddbEuWest1 :: Region #

ddbEuCentral1 :: Region #

ddbApNe1 :: Region #

ddbApSe1 :: Region #

ddbApSe2 :: Region #

ddbSaEast1 :: Region #

data DdbConfiguration qt #

Constructors

DdbConfiguration |
Fields ddbcRegion :: Region The regional endpoint. Ex: `ddbUsEast` ddbcProtocol :: Protocol `HTTP` or `HTTPS` ddbcPort :: Maybe Int Port override (mostly for local dev connection)

Instances

Show (DdbConfiguration qt) # |
Methods showsPrec :: Int -> DdbConfiguration qt -> ShowS # show :: DdbConfiguration qt -> String # showList :: [DdbConfiguration qt] -> ShowS #
Default (DdbConfiguration NormalQuery) # |
Methods def :: DdbConfiguration NormalQuery #
DefaultServiceConfiguration (DdbConfiguration NormalQuery) # |
Methods defServiceConfig :: DdbConfiguration NormalQuery # debugServiceConfig :: DdbConfiguration NormalQuery #

# DynamoDB values

data DValue #

Value types natively recognized by DynamoDb. We pretty much exactly reflect the AWS API onto Haskell types.

Constructors

DNull |
DNum Scientific |
DString Text |
DBinary ByteString | Binary data will automatically be base64 marshalled.
DNumSet (Set Scientific) |
DStringSet (Set Text) |
DBinSet (Set ByteString) | Binary data will automatically be base64 marshalled.
DBool Bool |
DBoolSet (Set Bool) | Composite data
DList (Vector DValue) |
DMap (Map Text DValue) |

Instances

Eq DValue # |
Methods (==) :: DValue -> DValue -> Bool # (/=) :: DValue -> DValue -> Bool #
Ord DValue # |
Methods compare :: DValue -> DValue -> Ordering # (<) :: DValue -> DValue -> Bool # (<=) :: DValue -> DValue -> Bool # (>) :: DValue -> DValue -> Bool # (>=) :: DValue -> DValue -> Bool # max :: DValue -> DValue -> DValue # min :: DValue -> DValue -> DValue #
Read DValue # |
Methods readsPrec :: Int -> ReadS DValue # readList :: ReadS [DValue] # readPrec :: ReadPrec DValue # readListPrec :: ReadPrec [DValue] #
Show DValue # |
Methods showsPrec :: Int -> DValue -> ShowS # show :: DValue -> String # showList :: [DValue] -> ShowS #
IsString DValue # |
Methods fromString :: String -> DValue #
ToJSON DValue # |
Methods toJSON :: DValue -> Value # toEncoding :: DValue -> Encoding # toJSONList :: [DValue] -> Value # toEncodingList :: [DValue] -> Encoding #
FromJSON DValue # |
Methods parseJSON :: Value -> Parser DValue # parseJSONList :: Value -> Parser [DValue] #
FromDynItem Item # |
Methods parseItem :: Item -> Parser Item #
ToDynItem Item # |
Methods toItem :: Item -> Item #
DynSize Item # |
Methods dynSize :: Item -> Int #
DynSize DValue # |
Methods dynSize :: DValue -> Int #
DynVal DValue # |
Associated Types type DynRep DValue :: * # Methods toRep :: DValue -> DynRep DValue # fromRep :: DynRep DValue -> Maybe DValue #
DynData DValue # |
Methods fromData :: DValue -> DValue # toData :: DValue -> Maybe DValue #
ListResponse QueryResponse Item # |
Methods listResponse :: QueryResponse -> [Item] #
ListResponse ScanResponse Item # |
Methods listResponse :: ScanResponse -> [Item] #
type DynRep DValue # |
type DynRep DValue = DValue

# Converting to/from `DValue`

class DynData (DynRep a) => DynVal a where #

Class of Haskell types that can be represented as DynamoDb values.

This is the conversion layer; instantiate this class for your own types and then use the `toValue` and `fromValue` combinators to convert in application code.

Each Haskell type instantiated with this class will map to a DynamoDb-supported type that most naturally represents it.

Minimal complete definition

toRep, fromRep

Associated Types

type DynRep a #

Which of the `DynData` instances does this data type directly map to?

Methods

toRep :: a -> DynRep a #

Convert to representation

fromRep :: DynRep a -> Maybe a #

Convert from representation

Instances

DynVal Bool # |
Associated Types type DynRep Bool :: * # Methods toRep :: Bool -> DynRep Bool # fromRep :: DynRep Bool -> Maybe Bool #
DynVal Double # |
Associated Types type DynRep Double :: * # Methods toRep :: Double -> DynRep Double # fromRep :: DynRep Double -> Maybe Double #
DynVal Int # |
Associated Types type DynRep Int :: * # Methods toRep :: Int -> DynRep Int # fromRep :: DynRep Int -> Maybe Int #
DynVal Int8 # |
Associated Types type DynRep Int8 :: * # Methods toRep :: Int8 -> DynRep Int8 # fromRep :: DynRep Int8 -> Maybe Int8 #
DynVal Int16 # |
Associated Types type DynRep Int16 :: * # Methods toRep :: Int16 -> DynRep Int16 # fromRep :: DynRep Int16 -> Maybe Int16 #
DynVal Int32 # |
Associated Types type DynRep Int32 :: * # Methods toRep :: Int32 -> DynRep Int32 # fromRep :: DynRep Int32 -> Maybe Int32 #
DynVal Int64 # |
Associated Types type DynRep Int64 :: * # Methods toRep :: Int64 -> DynRep Int64 # fromRep :: DynRep Int64 -> Maybe Int64 #
DynVal Integer # |
Associated Types type DynRep Integer :: * # Methods toRep :: Integer -> DynRep Integer # fromRep :: DynRep Integer -> Maybe Integer #
DynVal Word8 # |
Associated Types type DynRep Word8 :: * # Methods toRep :: Word8 -> DynRep Word8 # fromRep :: DynRep Word8 -> Maybe Word8 #
DynVal Word16 # |
Associated Types type DynRep Word16 :: * # Methods toRep :: Word16 -> DynRep Word16 # fromRep :: DynRep Word16 -> Maybe Word16 #
DynVal Word32 # |
Associated Types type DynRep Word32 :: * # Methods toRep :: Word32 -> DynRep Word32 # fromRep :: DynRep Word32 -> Maybe Word32 #
DynVal Word64 # |
Associated Types type DynRep Word64 :: * # Methods toRep :: Word64 -> DynRep Word64 # fromRep :: DynRep Word64 -> Maybe Word64 #
DynVal ByteString # |
Associated Types type DynRep ByteString :: * # Methods toRep :: ByteString -> DynRep ByteString # fromRep :: DynRep ByteString -> Maybe ByteString #
DynVal Text # |
Associated Types type DynRep Text :: * # Methods toRep :: Text -> DynRep Text # fromRep :: DynRep Text -> Maybe Text #
DynVal UTCTime # | Losslessly encoded via `Integer` picoseconds
Associated Types type DynRep UTCTime :: * # Methods toRep :: UTCTime -> DynRep UTCTime # fromRep :: DynRep UTCTime -> Maybe UTCTime #
DynVal Day # | Encoded as number of days
Associated Types type DynRep Day :: * # Methods toRep :: Day -> DynRep Day # fromRep :: DynRep Day -> Maybe Day #
DynVal DValue # |
Associated Types type DynRep DValue :: * # Methods toRep :: DValue -> DynRep DValue # fromRep :: DynRep DValue -> Maybe DValue #
DynVal OldBool # |
Associated Types type DynRep OldBool :: * # Methods toRep :: OldBool -> DynRep OldBool # fromRep :: DynRep OldBool -> Maybe OldBool #
(DynData (DynRep [a]), DynVal a) => DynVal [a] # | Any singular `DynVal` can be upgraded to a list.
Associated Types type DynRep [a] :: * # Methods toRep :: [a] -> DynRep [a] # fromRep :: DynRep [a] -> Maybe [a] #
(DynData (DynRep (Set a)), DynVal a, Ord a) => DynVal (Set a) # | Any singular `DynVal` can be upgraded to a `Set`.
Associated Types type DynRep (Set a) :: * # Methods toRep :: Set a -> DynRep (Set a) # fromRep :: DynRep (Set a) -> Maybe (Set a) #
Serialize a => DynVal (Bin a) # |
Associated Types type DynRep (Bin a) :: * # Methods toRep :: Bin a -> DynRep (Bin a) # fromRep :: DynRep (Bin a) -> Maybe (Bin a) #

toValue :: DynVal a => a -> DValue #

Encode a Haskell value.

fromValue :: DynVal a => DValue -> Maybe a #

Decode a Haskell value.

newtype Bin a #

Type wrapper for binary data to be written to DynamoDB. Wrap any `Serialize` instance in there and `DynVal` will know how to automatically handle conversions in binary form.

Constructors

Bin |
Fields getBin :: a

Instances

Enum a => Enum (Bin a) # |
Methods succ :: Bin a -> Bin a # pred :: Bin a -> Bin a # toEnum :: Int -> Bin a # fromEnum :: Bin a -> Int # enumFrom :: Bin a -> [Bin a] # enumFromThen :: Bin a -> Bin a -> [Bin a] # enumFromTo :: Bin a -> Bin a -> [Bin a] # enumFromThenTo :: Bin a -> Bin a -> Bin a -> [Bin a] #
Eq a => Eq (Bin a) # |
Methods (==) :: Bin a -> Bin a -> Bool # (/=) :: Bin a -> Bin a -> Bool #
Ord a => Ord (Bin a) # |
Methods compare :: Bin a -> Bin a -> Ordering # (<) :: Bin a -> Bin a -> Bool # (<=) :: Bin a -> Bin a -> Bool # (>) :: Bin a -> Bin a -> Bool # (>=) :: Bin a -> Bin a -> Bool # max :: Bin a -> Bin a -> Bin a # min :: Bin a -> Bin a -> Bin a #
Read a => Read (Bin a) # |
Methods readsPrec :: Int -> ReadS (Bin a) # readList :: ReadS [Bin a] # readPrec :: ReadPrec (Bin a) # readListPrec :: ReadPrec [Bin a] #
Show a => Show (Bin a) # |
Methods showsPrec :: Int -> Bin a -> ShowS # show :: Bin a -> String # showList :: [Bin a] -> ShowS #
Serialize a => DynVal (Bin a) # |
Associated Types type DynRep (Bin a) :: * # Methods toRep :: Bin a -> DynRep (Bin a) # fromRep :: DynRep (Bin a) -> Maybe (Bin a) #
type DynRep (Bin a) # |
type DynRep (Bin a) = DynBinary

newtype OldBool #

Constructors

OldBool Bool |

Instances

DynVal OldBool # |
Associated Types type DynRep OldBool :: * # Methods toRep :: OldBool -> DynRep OldBool # fromRep :: DynRep OldBool -> Maybe OldBool #
type DynRep OldBool # |
type DynRep OldBool = DynNumber

# Defining new `DynVal` instances

class Ord a => DynData a where #

An internally used closed typeclass for values that have direct DynamoDb representations. Based on AWS API, this is basically numbers, strings and binary blobs.

This is here so that any `DynVal` haskell value can automatically be lifted to a list or a `Set` without any instance code duplication.

Do not try to create your own instances.

Minimal complete definition

fromData, toData

Methods

fromData :: a -> DValue #

toData :: DValue -> Maybe a #

Instances

DynData DValue # |
Methods fromData :: DValue -> DValue # toData :: DValue -> Maybe DValue #
DynData DynBinary # |
Methods fromData :: DynBinary -> DValue # toData :: DValue -> Maybe DynBinary #
DynData DynString # |
Methods fromData :: DynString -> DValue # toData :: DValue -> Maybe DynString #
DynData DynNumber # |
Methods fromData :: DynNumber -> DValue # toData :: DValue -> Maybe DynNumber #
DynData DynBool # |
Methods fromData :: DynBool -> DValue # toData :: DValue -> Maybe DynBool #
DynData (Set DynBinary) # |
Methods fromData :: Set DynBinary -> DValue # toData :: DValue -> Maybe (Set DynBinary) #
DynData (Set DynString) # |
Methods fromData :: Set DynString -> DValue # toData :: DValue -> Maybe (Set DynString) #
DynData (Set DynNumber) # |
Methods fromData :: Set DynNumber -> DValue # toData :: DValue -> Maybe (Set DynNumber) #
DynData (Set DynBool) # |
Methods fromData :: Set DynBool -> DValue # toData :: DValue -> Maybe (Set DynBool) #

newtype DynBinary #

Binary values stored in DynamoDb. Only used in defining new `DynVal` instances.

Constructors

DynBinary |
Fields unDynBinary :: ByteString

Instances

Eq DynBinary # |
Methods (==) :: DynBinary -> DynBinary -> Bool # (/=) :: DynBinary -> DynBinary -> Bool #
Ord DynBinary # |
Methods compare :: DynBinary -> DynBinary -> Ordering # (<) :: DynBinary -> DynBinary -> Bool # (<=) :: DynBinary -> DynBinary -> Bool # (>) :: DynBinary -> DynBinary -> Bool # (>=) :: DynBinary -> DynBinary -> Bool # max :: DynBinary -> DynBinary -> DynBinary # min :: DynBinary -> DynBinary -> DynBinary #
Read DynBinary # |
Methods readsPrec :: Int -> ReadS DynBinary # readList :: ReadS [DynBinary] # readPrec :: ReadPrec DynBinary # readListPrec :: ReadPrec [DynBinary] #
Show DynBinary # |
Methods showsPrec :: Int -> DynBinary -> ShowS # show :: DynBinary -> String # showList :: [DynBinary] -> ShowS #
DynData DynBinary # |
Methods fromData :: DynBinary -> DValue # toData :: DValue -> Maybe DynBinary #
DynData (Set DynBinary) # |
Methods fromData :: Set DynBinary -> DValue # toData :: DValue -> Maybe (Set DynBinary) #

newtype DynNumber #

Numeric values stored in DynamoDb. Only used in defining new `DynVal` instances.

Constructors

DynNumber |
Fields unDynNumber :: Scientific

Instances

Eq DynNumber # |
Methods (==) :: DynNumber -> DynNumber -> Bool # (/=) :: DynNumber -> DynNumber -> Bool #
Ord DynNumber # |
Methods compare :: DynNumber -> DynNumber -> Ordering # (<) :: DynNumber -> DynNumber -> Bool # (<=) :: DynNumber -> DynNumber -> Bool # (>) :: DynNumber -> DynNumber -> Bool # (>=) :: DynNumber -> DynNumber -> Bool # max :: DynNumber -> DynNumber -> DynNumber # min :: DynNumber -> DynNumber -> DynNumber #
Read DynNumber # |
Methods readsPrec :: Int -> ReadS DynNumber # readList :: ReadS [DynNumber] # readPrec :: ReadPrec DynNumber # readListPrec :: ReadPrec [DynNumber] #
Show DynNumber # |
Methods showsPrec :: Int -> DynNumber -> ShowS # show :: DynNumber -> String # showList :: [DynNumber] -> ShowS #
DynData DynNumber # |
Methods fromData :: DynNumber -> DValue # toData :: DValue -> Maybe DynNumber #
DynData (Set DynNumber) # |
Methods fromData :: Set DynNumber -> DValue # toData :: DValue -> Maybe (Set DynNumber) #

newtype DynString #

String values stored in DynamoDb. Only used in defining new `DynVal` instances.

Constructors

DynString |
Fields unDynString :: Text

Instances

Eq DynString # |
Methods (==) :: DynString -> DynString -> Bool # (/=) :: DynString -> DynString -> Bool #
Ord DynString # |
Methods compare :: DynString -> DynString -> Ordering # (<) :: DynString -> DynString -> Bool # (<=) :: DynString -> DynString -> Bool # (>) :: DynString -> DynString -> Bool # (>=) :: DynString -> DynString -> Bool # max :: DynString -> DynString -> DynString # min :: DynString -> DynString -> DynString #
Read DynString # |
Methods readsPrec :: Int -> ReadS DynString # readList :: ReadS [DynString] # readPrec :: ReadPrec DynString # readListPrec :: ReadPrec [DynString] #
Show DynString # |
Methods showsPrec :: Int -> DynString -> ShowS # show :: DynString -> String # showList :: [DynString] -> ShowS #
DynData DynString # |
Methods fromData :: DynString -> DValue # toData :: DValue -> Maybe DynString #
DynData (Set DynString) # |
Methods fromData :: Set DynString -> DValue # toData :: DValue -> Maybe (Set DynString) #

newtype DynBool #

Boolean values stored in DynamoDb. Only used in defining new `DynVal` instances.

Constructors

DynBool |
Fields unDynBool :: Bool

Instances

Eq DynBool # |
Methods (==) :: DynBool -> DynBool -> Bool # (/=) :: DynBool -> DynBool -> Bool #
Ord DynBool # |
Methods compare :: DynBool -> DynBool -> Ordering # (<) :: DynBool -> DynBool -> Bool # (<=) :: DynBool -> DynBool -> Bool # (>) :: DynBool -> DynBool -> Bool # (>=) :: DynBool -> DynBool -> Bool # max :: DynBool -> DynBool -> DynBool # min :: DynBool -> DynBool -> DynBool #
Read DynBool # |
Methods readsPrec :: Int -> ReadS DynBool # readList :: ReadS [DynBool] # readPrec :: ReadPrec DynBool # readListPrec :: ReadPrec [DynBool] #
Show DynBool # |
Methods showsPrec :: Int -> DynBool -> ShowS # show :: DynBool -> String # showList :: [DynBool] -> ShowS #
DynData DynBool # |
Methods fromData :: DynBool -> DValue # toData :: DValue -> Maybe DynBool #
DynData (Set DynBool) # |
Methods fromData :: Set DynBool -> DValue # toData :: DValue -> Maybe (Set DynBool) #

# Working with key/value pairs

data Attribute #

A key-value pair

Constructors

Attribute |
Fields attrName :: Text attrVal :: DValue

Instances

Eq Attribute # |
Methods (==) :: Attribute -> Attribute -> Bool # (/=) :: Attribute -> Attribute -> Bool #
Ord Attribute # |
Methods compare :: Attribute -> Attribute -> Ordering # (<) :: Attribute -> Attribute -> Bool # (<=) :: Attribute -> Attribute -> Bool # (>) :: Attribute -> Attribute -> Bool # (>=) :: Attribute -> Attribute -> Bool # max :: Attribute -> Attribute -> Attribute # min :: Attribute -> Attribute -> Attribute #
Read Attribute # |
Methods readsPrec :: Int -> ReadS Attribute # readList :: ReadS [Attribute] # readPrec :: ReadPrec Attribute # readListPrec :: ReadPrec [Attribute] #
Show Attribute # |
Methods showsPrec :: Int -> Attribute -> ShowS # show :: Attribute -> String # showList :: [Attribute] -> ShowS #
ToJSON Attribute # |
Methods toJSON :: Attribute -> Value # toEncoding :: Attribute -> Encoding # toJSONList :: [Attribute] -> Value # toEncodingList :: [Attribute] -> Encoding #
DynSize Attribute # |
Methods dynSize :: Attribute -> Int #

parseAttributeJson :: Value -> Parser [Attribute] #

Parse a JSON object that contains attributes

attributeJson :: Attribute -> Pair #

Convert into JSON pair

attributesJson :: [Attribute] -> Value #

Convert into JSON object for AWS.

attrTuple :: Attribute -> (Text, DValue) #

Convert attribute to a tuple representation

attr :: DynVal a => Text -> a -> Attribute #

Convenience function for constructing key-value pairs

attrAs :: DynVal a => Proxy a -> Text -> a -> Attribute #

`attr` with type witness to help with cases where you're manually supplying values in code.

    > item [ attrAs text "name" "john" ]

text :: Proxy Text #

Type witness for `Text`. See `attrAs`.

int :: Proxy Integer #

Type witness for `Integer`. See `attrAs`.

double :: Proxy Double #

Type witness for `Double`. See `attrAs`.

data PrimaryKey #

Primary keys consist of either just a Hash key (mandatory) or a hash key and a range key (optional).

Constructors

PrimaryKey |
Fields pkHash :: Attribute pkRange :: Maybe Attribute

Instances

Eq PrimaryKey # |
Methods (==) :: PrimaryKey -> PrimaryKey -> Bool # (/=) :: PrimaryKey -> PrimaryKey -> Bool #
Ord PrimaryKey # |
Methods compare :: PrimaryKey -> PrimaryKey -> Ordering # (<) :: PrimaryKey -> PrimaryKey -> Bool # (<=) :: PrimaryKey -> PrimaryKey -> Bool # (>) :: PrimaryKey -> PrimaryKey -> Bool # (>=) :: PrimaryKey -> PrimaryKey -> Bool # max :: PrimaryKey -> PrimaryKey -> PrimaryKey # min :: PrimaryKey -> PrimaryKey -> PrimaryKey #
Read PrimaryKey # |
Methods readsPrec :: Int -> ReadS PrimaryKey # readList :: ReadS [PrimaryKey] # readPrec :: ReadPrec PrimaryKey # readListPrec :: ReadPrec [PrimaryKey] #
Show PrimaryKey # |
Methods showsPrec :: Int -> PrimaryKey -> ShowS # show :: PrimaryKey -> String # showList :: [PrimaryKey] -> ShowS #
ToJSON PrimaryKey # |
Methods toJSON :: PrimaryKey -> Value # toEncoding :: PrimaryKey -> Encoding # toJSONList :: [PrimaryKey] -> Value # toEncodingList :: [PrimaryKey] -> Encoding #

hk :: Text -> DValue -> PrimaryKey #

Construct a hash-only primary key.

    >>> hk "user-id" "ABCD"

    >>> hk "user-id" (mkVal 23)

hrk #

Arguments

:: Text | Hash key name
-> DValue | Hash key value
-> Text | Range key name
-> DValue | Range key value
-> PrimaryKey |

Construct a hash-and-range primary key.

# Working with objects (attribute collections)

type Item = Map Text DValue #

A DynamoDb object is simply a key-value dictionary.

item :: [Attribute] -> Item #

Pack a list of attributes into an Item.

attributes :: Map Text DValue -> [Attribute] #

Unpack an `Item` into a list of attributes.

class ToDynItem a where #

Types convertible to DynamoDb `Item` collections.

Use `attr` and `attrAs` combinators to conveniently define instances.

Minimal complete definition

toItem

Methods

toItem :: a -> Item #

Instances

ToDynItem Item # |
Methods toItem :: Item -> Item #
DynVal a => ToDynItem [(Text, a)] # |
Methods toItem :: [(Text, a)] -> Item #
DynVal a => ToDynItem (Map Text a) # |
Methods toItem :: Map Text a -> Item #

class FromDynItem a where #

Types parseable from DynamoDb `Item` collections.

User `getAttr` family of functions to applicatively or monadically parse into your custom types.

Minimal complete definition

parseItem

Methods

parseItem :: Item -> Parser a #

Instances

FromDynItem Item # |
Methods parseItem :: Item -> Parser Item #
(Typeable * a, DynVal a) => FromDynItem [(Text, a)] # |
Methods parseItem :: Item -> Parser [(Text, a)] #
(Typeable * a, DynVal a) => FromDynItem (Map Text a) # |
Methods parseItem :: Item -> Parser (Map Text a) #

fromItem :: FromDynItem a => Item -> Either String a #

Parse an `Item` into target type using the `FromDynItem` instance.

newtype Parser a #

A continuation-based parser type.

Constructors

Parser |
Fields runParser :: forall f r. Failure f r -> Success a f r -> f r

Instances

Monad Parser # |
Methods (>>=) :: Parser a -> (a -> Parser b) -> Parser b # (>>) :: Parser a -> Parser b -> Parser b # return :: a -> Parser a # fail :: String -> Parser a #
Functor Parser # |
Methods fmap :: (a -> b) -> Parser a -> Parser b # (<$) :: a -> Parser b -> Parser a #
Applicative Parser # |
Methods pure :: a -> Parser a # (<*>) :: Parser (a -> b) -> Parser a -> Parser b # (*>) :: Parser a -> Parser b -> Parser b # (<*) :: Parser a -> Parser b -> Parser a #
Alternative Parser # |
Methods empty :: Parser a # (<|>) :: Parser a -> Parser a -> Parser a # some :: Parser a -> Parser [a] # many :: Parser a -> Parser [a] #
MonadPlus Parser # |
Methods mzero :: Parser a # mplus :: Parser a -> Parser a -> Parser a #
Monoid (Parser a) # |
Methods mempty :: Parser a # mappend :: Parser a -> Parser a -> Parser a # mconcat :: [Parser a] -> Parser a #

getAttr #

Arguments

:: (Typeable a, DynVal a) |
=> Text | Attribute name
-> Item | Item from DynamoDb
-> Parser a |

Convenience combinator for parsing fields from an `Item` returned by DynamoDb.

getAttr' #

Arguments

:: DynVal a |
=> Text | Attribute name
-> Item | Item from DynamoDb
-> Parser (Maybe a) |

Parse attribute if it's present in the `Item`. Fail if attribute is present but conversion fails.

parseAttr #

Arguments

:: FromDynItem a |
=> Text | Attribute name
-> Item | Item from DynamoDb
-> Parser a |

Combinator for parsing an attribute into a `FromDynItem`.

# Common types used by operations

data Conditions #

Conditions used by mutation operations (`PutItem`, `UpdateItem`, etc.). The default `def` instance is empty (no condition).

Constructors

Conditions CondMerge [Condition] |

Instances

Eq Conditions # |
Methods (==) :: Conditions -> Conditions -> Bool # (/=) :: Conditions -> Conditions -> Bool #
Ord Conditions # |
Methods compare :: Conditions -> Conditions -> Ordering # (<) :: Conditions -> Conditions -> Bool # (<=) :: Conditions -> Conditions -> Bool # (>) :: Conditions -> Conditions -> Bool # (>=) :: Conditions -> Conditions -> Bool # max :: Conditions -> Conditions -> Conditions # min :: Conditions -> Conditions -> Conditions #
Read Conditions # |
Methods readsPrec :: Int -> ReadS Conditions # readList :: ReadS [Conditions] # readPrec :: ReadPrec Conditions # readListPrec :: ReadPrec [Conditions] #
Show Conditions # |
Methods showsPrec :: Int -> Conditions -> ShowS # show :: Conditions -> String # showList :: [Conditions] -> ShowS #
Default Conditions # |
Methods def :: Conditions #

conditionsJson :: Text -> Conditions -> [Pair] #

JSON encoding of conditions parameter in various contexts.

expectsJson :: Conditions -> [Pair] #

data Condition #

A condition used by mutation operations (`PutItem`, `UpdateItem`, etc.).

Constructors

Condition |
Fields condAttr :: Text Attribute to use as the basis for this conditional condOp :: CondOp Operation on the selected attribute

Instances

Eq Condition # |
Methods (==) :: Condition -> Condition -> Bool # (/=) :: Condition -> Condition -> Bool #
Ord Condition # |
Methods compare :: Condition -> Condition -> Ordering # (<) :: Condition -> Condition -> Bool # (<=) :: Condition -> Condition -> Bool # (>) :: Condition -> Condition -> Bool # (>=) :: Condition -> Condition -> Bool # max :: Condition -> Condition -> Condition # min :: Condition -> Condition -> Condition #
Read Condition # |
Methods readsPrec :: Int -> ReadS Condition # readList :: ReadS [Condition] # readPrec :: ReadPrec Condition # readListPrec :: ReadPrec [Condition] #
Show Condition # |
Methods showsPrec :: Int -> Condition -> ShowS # show :: Condition -> String # showList :: [Condition] -> ShowS #

conditionJson :: Condition -> Pair #

data CondOp #

Conditional operation to perform on a field.

Constructors

DEq DValue |
NotEq DValue |
DLE DValue |
DLT DValue |
DGE DValue |
DGT DValue |
NotNull |
IsNull |
Contains DValue |
NotContains DValue |
Begins DValue |
In [DValue] |
Between DValue DValue |

Instances

Eq CondOp # |
Methods (==) :: CondOp -> CondOp -> Bool # (/=) :: CondOp -> CondOp -> Bool #
Ord CondOp # |
Methods compare :: CondOp -> CondOp -> Ordering # (<) :: CondOp -> CondOp -> Bool # (<=) :: CondOp -> CondOp -> Bool # (>) :: CondOp -> CondOp -> Bool # (>=) :: CondOp -> CondOp -> Bool # max :: CondOp -> CondOp -> CondOp # min :: CondOp -> CondOp -> CondOp #
Read CondOp # |
Methods readsPrec :: Int -> ReadS CondOp # readList :: ReadS [CondOp] # readPrec :: ReadPrec CondOp # readListPrec :: ReadPrec [CondOp] #
Show CondOp # |
Methods showsPrec :: Int -> CondOp -> ShowS # show :: CondOp -> String # showList :: [CondOp] -> ShowS #
ToJSON CondOp # |
Methods toJSON :: CondOp -> Value # toEncoding :: CondOp -> Encoding # toJSONList :: [CondOp] -> Value # toEncodingList :: [CondOp] -> Encoding #

data CondMerge #

How to merge multiple conditions.

Constructors

CondAnd |
CondOr |

Instances

Eq CondMerge # |
Methods (==) :: CondMerge -> CondMerge -> Bool # (/=) :: CondMerge -> CondMerge -> Bool #
Ord CondMerge # |
Methods compare :: CondMerge -> CondMerge -> Ordering # (<) :: CondMerge -> CondMerge -> Bool # (<=) :: CondMerge -> CondMerge -> Bool # (>) :: CondMerge -> CondMerge -> Bool # (>=) :: CondMerge -> CondMerge -> Bool # max :: CondMerge -> CondMerge -> CondMerge # min :: CondMerge -> CondMerge -> CondMerge #
Read CondMerge # |
Methods readsPrec :: Int -> ReadS CondMerge # readList :: ReadS [CondMerge] # readPrec :: ReadPrec CondMerge # readListPrec :: ReadPrec [CondMerge] #
Show CondMerge # |
Methods showsPrec :: Int -> CondMerge -> ShowS # show :: CondMerge -> String # showList :: [CondMerge] -> ShowS #

data ConsumedCapacity #

The standard response metrics on capacity consumption.

Constructors

ConsumedCapacity |
Fields capacityUnits :: Int64 capacityGlobalIndex :: [(Text, Int64)] capacityLocalIndex :: [(Text, Int64)] capacityTableUnits :: Maybe Int64 capacityTable :: Text

Instances

Eq ConsumedCapacity # |
Methods (==) :: ConsumedCapacity -> ConsumedCapacity -> Bool # (/=) :: ConsumedCapacity -> ConsumedCapacity -> Bool #
Ord ConsumedCapacity # |
Methods compare :: ConsumedCapacity -> ConsumedCapacity -> Ordering # (<) :: ConsumedCapacity -> ConsumedCapacity -> Bool # (<=) :: ConsumedCapacity -> ConsumedCapacity -> Bool # (>) :: ConsumedCapacity -> ConsumedCapacity -> Bool # (>=) :: ConsumedCapacity -> ConsumedCapacity -> Bool # max :: ConsumedCapacity -> ConsumedCapacity -> ConsumedCapacity # min :: ConsumedCapacity -> ConsumedCapacity -> ConsumedCapacity #
Read ConsumedCapacity # |
Methods readsPrec :: Int -> ReadS ConsumedCapacity # readList :: ReadS [ConsumedCapacity] # readPrec :: ReadPrec ConsumedCapacity # readListPrec :: ReadPrec [ConsumedCapacity] #
Show ConsumedCapacity # |
Methods showsPrec :: Int -> ConsumedCapacity -> ShowS # show :: ConsumedCapacity -> String # showList :: [ConsumedCapacity] -> ShowS #
FromJSON ConsumedCapacity # |
Methods parseJSON :: Value -> Parser ConsumedCapacity # parseJSONList :: Value -> Parser [ConsumedCapacity] #

data ReturnConsumption #

Constructors

RCIndexes |
RCTotal |
RCNone |

Instances

Eq ReturnConsumption # |
Methods (==) :: ReturnConsumption -> ReturnConsumption -> Bool # (/=) :: ReturnConsumption -> ReturnConsumption -> Bool #
Ord ReturnConsumption # |
Methods compare :: ReturnConsumption -> ReturnConsumption -> Ordering # (<) :: ReturnConsumption -> ReturnConsumption -> Bool # (<=) :: ReturnConsumption -> ReturnConsumption -> Bool # (>) :: ReturnConsumption -> ReturnConsumption -> Bool # (>=) :: ReturnConsumption -> ReturnConsumption -> Bool # max :: ReturnConsumption -> ReturnConsumption -> ReturnConsumption # min :: ReturnConsumption -> ReturnConsumption -> ReturnConsumption #
Read ReturnConsumption # |
Methods readsPrec :: Int -> ReadS ReturnConsumption # readList :: ReadS [ReturnConsumption] # readPrec :: ReadPrec ReturnConsumption # readListPrec :: ReadPrec [ReturnConsumption] #
Show ReturnConsumption # |
Methods showsPrec :: Int -> ReturnConsumption -> ShowS # show :: ReturnConsumption -> String # showList :: [ReturnConsumption] -> ShowS #
ToJSON ReturnConsumption # |
Methods toJSON :: ReturnConsumption -> Value # toEncoding :: ReturnConsumption -> Encoding # toJSONList :: [ReturnConsumption] -> Value # toEncodingList :: [ReturnConsumption] -> Encoding #
Default ReturnConsumption # |
Methods def :: ReturnConsumption #

data ItemCollectionMetrics #

Constructors

ItemCollectionMetrics |
Fields icmKey :: (Text, DValue) icmEstimate :: [Double]

Instances

Eq ItemCollectionMetrics # |
Methods (==) :: ItemCollectionMetrics -> ItemCollectionMetrics -> Bool # (/=) :: ItemCollectionMetrics -> ItemCollectionMetrics -> Bool #
Ord ItemCollectionMetrics # |
Methods compare :: ItemCollectionMetrics -> ItemCollectionMetrics -> Ordering # (<) :: ItemCollectionMetrics -> ItemCollectionMetrics -> Bool # (<=) :: ItemCollectionMetrics -> ItemCollectionMetrics -> Bool # (>) :: ItemCollectionMetrics -> ItemCollectionMetrics -> Bool # (>=) :: ItemCollectionMetrics -> ItemCollectionMetrics -> Bool # max :: ItemCollectionMetrics -> ItemCollectionMetrics -> ItemCollectionMetrics # min :: ItemCollectionMetrics -> ItemCollectionMetrics -> ItemCollectionMetrics #
Read ItemCollectionMetrics # |
Methods readsPrec :: Int -> ReadS ItemCollectionMetrics # readList :: ReadS [ItemCollectionMetrics] # readPrec :: ReadPrec ItemCollectionMetrics # readListPrec :: ReadPrec [ItemCollectionMetrics] #
Show ItemCollectionMetrics # |
Methods showsPrec :: Int -> ItemCollectionMetrics -> ShowS # show :: ItemCollectionMetrics -> String # showList :: [ItemCollectionMetrics] -> ShowS #
FromJSON ItemCollectionMetrics # |
Methods parseJSON :: Value -> Parser ItemCollectionMetrics # parseJSONList :: Value -> Parser [ItemCollectionMetrics] #

data ReturnItemCollectionMetrics #

Constructors

RICMSize |
RICMNone |

Instances

Eq ReturnItemCollectionMetrics # |
Methods (==) :: ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics -> Bool # (/=) :: ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics -> Bool #
Ord ReturnItemCollectionMetrics # |
Methods compare :: ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics -> Ordering # (<) :: ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics -> Bool # (<=) :: ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics -> Bool # (>) :: ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics -> Bool # (>=) :: ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics -> Bool # max :: ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics # min :: ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics -> ReturnItemCollectionMetrics #
Read ReturnItemCollectionMetrics # |
Methods readsPrec :: Int -> ReadS ReturnItemCollectionMetrics # readList :: ReadS [ReturnItemCollectionMetrics] # readPrec :: ReadPrec ReturnItemCollectionMetrics # readListPrec :: ReadPrec [ReturnItemCollectionMetrics] #
Show ReturnItemCollectionMetrics # |
Methods showsPrec :: Int -> ReturnItemCollectionMetrics -> ShowS # show :: ReturnItemCollectionMetrics -> String # showList :: [ReturnItemCollectionMetrics] -> ShowS #
ToJSON ReturnItemCollectionMetrics # |
Methods toJSON :: ReturnItemCollectionMetrics -> Value # toEncoding :: ReturnItemCollectionMetrics -> Encoding # toJSONList :: [ReturnItemCollectionMetrics] -> Value # toEncodingList :: [ReturnItemCollectionMetrics] -> Encoding #
Default ReturnItemCollectionMetrics # |
Methods def :: ReturnItemCollectionMetrics #

data UpdateReturn #

What to return from the current update operation

Constructors

URNone | Return nothing
URAllOld | Return old values
URUpdatedOld | Return old values with a newer replacement
URAllNew | Return new values
URUpdatedNew | Return new values that were replacements

Instances

Eq UpdateReturn # |
Methods (==) :: UpdateReturn -> UpdateReturn -> Bool # (/=) :: UpdateReturn -> UpdateReturn -> Bool #
Ord UpdateReturn # |
Methods compare :: UpdateReturn -> UpdateReturn -> Ordering # (<) :: UpdateReturn -> UpdateReturn -> Bool # (<=) :: UpdateReturn -> UpdateReturn -> Bool # (>) :: UpdateReturn -> UpdateReturn -> Bool # (>=) :: UpdateReturn -> UpdateReturn -> Bool # max :: UpdateReturn -> UpdateReturn -> UpdateReturn # min :: UpdateReturn -> UpdateReturn -> UpdateReturn #
Read UpdateReturn # |
Methods readsPrec :: Int -> ReadS UpdateReturn # readList :: ReadS [UpdateReturn] # readPrec :: ReadPrec UpdateReturn # readListPrec :: ReadPrec [UpdateReturn] #
Show UpdateReturn # |
Methods showsPrec :: Int -> UpdateReturn -> ShowS # show :: UpdateReturn -> String # showList :: [UpdateReturn] -> ShowS #
ToJSON UpdateReturn # |
Methods toJSON :: UpdateReturn -> Value # toEncoding :: UpdateReturn -> Encoding # toJSONList :: [UpdateReturn] -> Value # toEncodingList :: [UpdateReturn] -> Encoding #
Default UpdateReturn # |
Methods def :: UpdateReturn #

data QuerySelect #

What to return from a `Query` or `Scan` query.

Constructors

SelectSpecific [Text] | Only return selected attributes
SelectCount | Return counts instead of attributes
SelectProjected | Return index-projected attributes
SelectAll | Default. Return everything.

Instances

Eq QuerySelect # |
Methods (==) :: QuerySelect -> QuerySelect -> Bool # (/=) :: QuerySelect -> QuerySelect -> Bool #
Ord QuerySelect # |
Methods compare :: QuerySelect -> QuerySelect -> Ordering # (<) :: QuerySelect -> QuerySelect -> Bool # (<=) :: QuerySelect -> QuerySelect -> Bool # (>) :: QuerySelect -> QuerySelect -> Bool # (>=) :: QuerySelect -> QuerySelect -> Bool # max :: QuerySelect -> QuerySelect -> QuerySelect # min :: QuerySelect -> QuerySelect -> QuerySelect #
Read QuerySelect # |
Methods readsPrec :: Int -> ReadS QuerySelect # readList :: ReadS [QuerySelect] # readPrec :: ReadPrec QuerySelect # readListPrec :: ReadPrec [QuerySelect] #
Show QuerySelect # |
Methods showsPrec :: Int -> QuerySelect -> ShowS # show :: QuerySelect -> String # showList :: [QuerySelect] -> ShowS #
Default QuerySelect # |
Methods def :: QuerySelect #

querySelectJson :: KeyValue t => QuerySelect -> [t] #

# Size estimation

class DynSize a where #

A class to help predict DynamoDb size of values, attributes and entire items. The result is given in number of bytes.

Minimal complete definition

dynSize

Methods

dynSize :: a -> Int #

Instances

DynSize Item # |
Methods dynSize :: Item -> Int #
DynSize Attribute # |
Methods dynSize :: Attribute -> Int #
DynSize DValue # |
Methods dynSize :: DValue -> Int #
DynSize AttributeUpdate # |
Methods dynSize :: AttributeUpdate -> Int #
DynSize a => DynSize [a] # |
Methods dynSize :: [a] -> Int #
DynSize a => DynSize (Maybe a) # |
Methods dynSize :: Maybe a -> Int #
(DynSize a, DynSize b) => DynSize (Either a b) # |
Methods dynSize :: Either a b -> Int #

nullAttr :: Attribute -> Bool #

Will an attribute be considered empty by DynamoDb?

A `PutItem` (or similar) with empty attributes will be rejected with a `ValidationException`.

# Responses & Errors

data DdbResponse #

Response metadata that is present in every DynamoDB response.

Constructors

DdbResponse |
Fields ddbrCrc :: Maybe Text ddbrMsgId :: Maybe Text

Instances

Monoid DdbResponse # |
Methods mempty :: DdbResponse # mappend :: DdbResponse -> DdbResponse -> DdbResponse # mconcat :: [DdbResponse] -> DdbResponse #
Loggable DdbResponse # |
Methods toLogText :: DdbResponse -> Text #

data DdbErrCode #

Errors defined by AWS.

Constructors

AccessDeniedException |
ConditionalCheckFailedException |
IncompleteSignatureException |
InvalidSignatureException |
LimitExceededException |
MissingAuthenticationTokenException |
ProvisionedThroughputExceededException |
ResourceInUseException |
ResourceNotFoundException |
ThrottlingException |
ValidationException |
RequestTooLarge |
InternalFailure |
InternalServerError |
ServiceUnavailableException |
SerializationException | Raised by AWS when the request JSON is missing fields or is somehow malformed.

Instances

Eq DdbErrCode # |
Methods (==) :: DdbErrCode -> DdbErrCode -> Bool # (/=) :: DdbErrCode -> DdbErrCode -> Bool #
Read DdbErrCode # |
Methods readsPrec :: Int -> ReadS DdbErrCode # readList :: ReadS [DdbErrCode] # readPrec :: ReadPrec DdbErrCode # readListPrec :: ReadPrec [DdbErrCode] #
Show DdbErrCode # |
Methods showsPrec :: Int -> DdbErrCode -> ShowS # show :: DdbErrCode -> String # showList :: [DdbErrCode] -> ShowS #

shouldRetry :: DdbErrCode -> Bool #

Whether the action should be retried based on the received error.

data DdbError #

Potential errors raised by DynamoDB

Constructors

DdbError |
Fields ddbStatusCode :: Int 200 if successful, 400 for client errors and 500 for server-side errors. ddbErrCode :: DdbErrCode ddbErrMsg :: Text

Instances

Eq DdbError # |
Methods (==) :: DdbError -> DdbError -> Bool # (/=) :: DdbError -> DdbError -> Bool #
Show DdbError # |
Methods showsPrec :: Int -> DdbError -> ShowS # show :: DdbError -> String # showList :: [DdbError] -> ShowS #
Exception DdbError # |
Methods toException :: DdbError -> SomeException # fromException :: SomeException -> Maybe DdbError # displayException :: DdbError -> String #

# Internal Helpers

ddbSignQuery :: ToJSON a => ByteString -> a -> DdbConfiguration qt -> SignatureData -> SignedQuery #

data AmazonError #

Constructors

AmazonError |
Fields aeType :: Text aeMessage :: Maybe Text

Instances

FromJSON AmazonError # |
Methods parseJSON :: Value -> Parser AmazonError # parseJSONList :: Value -> Parser [AmazonError] #

ddbResponseConsumer :: FromJSON a => IORef DdbResponse -> HTTPResponseConsumer a #

ddbHttp :: Region -> DdbConfiguration NormalQuery #

ddbHttps :: Region -> DdbConfiguration NormalQuery #