{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.SQS.Types.MessageAttributeValue where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data MessageAttributeValue = MessageAttributeValue'
{
MessageAttributeValue -> Maybe Base64
binaryValue :: Prelude.Maybe Core.Base64,
MessageAttributeValue -> Maybe [Text]
stringListValues :: Prelude.Maybe [Prelude.Text],
MessageAttributeValue -> Maybe Text
stringValue :: Prelude.Maybe Prelude.Text,
MessageAttributeValue -> Maybe [Base64]
binaryListValues :: Prelude.Maybe [Core.Base64],
MessageAttributeValue -> Text
dataType :: Prelude.Text
}
deriving (MessageAttributeValue -> MessageAttributeValue -> Bool
(MessageAttributeValue -> MessageAttributeValue -> Bool)
-> (MessageAttributeValue -> MessageAttributeValue -> Bool)
-> Eq MessageAttributeValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MessageAttributeValue -> MessageAttributeValue -> Bool
$c/= :: MessageAttributeValue -> MessageAttributeValue -> Bool
== :: MessageAttributeValue -> MessageAttributeValue -> Bool
$c== :: MessageAttributeValue -> MessageAttributeValue -> Bool
Prelude.Eq, ReadPrec [MessageAttributeValue]
ReadPrec MessageAttributeValue
Int -> ReadS MessageAttributeValue
ReadS [MessageAttributeValue]
(Int -> ReadS MessageAttributeValue)
-> ReadS [MessageAttributeValue]
-> ReadPrec MessageAttributeValue
-> ReadPrec [MessageAttributeValue]
-> Read MessageAttributeValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MessageAttributeValue]
$creadListPrec :: ReadPrec [MessageAttributeValue]
readPrec :: ReadPrec MessageAttributeValue
$creadPrec :: ReadPrec MessageAttributeValue
readList :: ReadS [MessageAttributeValue]
$creadList :: ReadS [MessageAttributeValue]
readsPrec :: Int -> ReadS MessageAttributeValue
$creadsPrec :: Int -> ReadS MessageAttributeValue
Prelude.Read, Int -> MessageAttributeValue -> ShowS
[MessageAttributeValue] -> ShowS
MessageAttributeValue -> String
(Int -> MessageAttributeValue -> ShowS)
-> (MessageAttributeValue -> String)
-> ([MessageAttributeValue] -> ShowS)
-> Show MessageAttributeValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MessageAttributeValue] -> ShowS
$cshowList :: [MessageAttributeValue] -> ShowS
show :: MessageAttributeValue -> String
$cshow :: MessageAttributeValue -> String
showsPrec :: Int -> MessageAttributeValue -> ShowS
$cshowsPrec :: Int -> MessageAttributeValue -> ShowS
Prelude.Show, (forall x. MessageAttributeValue -> Rep MessageAttributeValue x)
-> (forall x. Rep MessageAttributeValue x -> MessageAttributeValue)
-> Generic MessageAttributeValue
forall x. Rep MessageAttributeValue x -> MessageAttributeValue
forall x. MessageAttributeValue -> Rep MessageAttributeValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MessageAttributeValue x -> MessageAttributeValue
$cfrom :: forall x. MessageAttributeValue -> Rep MessageAttributeValue x
Prelude.Generic)
newMessageAttributeValue ::
Prelude.Text ->
MessageAttributeValue
newMessageAttributeValue :: Text -> MessageAttributeValue
newMessageAttributeValue Text
pDataType_ =
MessageAttributeValue' :: Maybe Base64
-> Maybe [Text]
-> Maybe Text
-> Maybe [Base64]
-> Text
-> MessageAttributeValue
MessageAttributeValue'
{ $sel:binaryValue:MessageAttributeValue' :: Maybe Base64
binaryValue =
Maybe Base64
forall a. Maybe a
Prelude.Nothing,
$sel:stringListValues:MessageAttributeValue' :: Maybe [Text]
stringListValues = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:stringValue:MessageAttributeValue' :: Maybe Text
stringValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:binaryListValues:MessageAttributeValue' :: Maybe [Base64]
binaryListValues = Maybe [Base64]
forall a. Maybe a
Prelude.Nothing,
$sel:dataType:MessageAttributeValue' :: Text
dataType = Text
pDataType_
}
messageAttributeValue_binaryValue :: Lens.Lens' MessageAttributeValue (Prelude.Maybe Prelude.ByteString)
messageAttributeValue_binaryValue :: (Maybe ByteString -> f (Maybe ByteString))
-> MessageAttributeValue -> f MessageAttributeValue
messageAttributeValue_binaryValue = (MessageAttributeValue -> Maybe Base64)
-> (MessageAttributeValue -> Maybe Base64 -> MessageAttributeValue)
-> Lens
MessageAttributeValue
MessageAttributeValue
(Maybe Base64)
(Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageAttributeValue' {Maybe Base64
binaryValue :: Maybe Base64
$sel:binaryValue:MessageAttributeValue' :: MessageAttributeValue -> Maybe Base64
binaryValue} -> Maybe Base64
binaryValue) (\s :: MessageAttributeValue
s@MessageAttributeValue' {} Maybe Base64
a -> MessageAttributeValue
s {$sel:binaryValue:MessageAttributeValue' :: Maybe Base64
binaryValue = Maybe Base64
a} :: MessageAttributeValue) ((Maybe Base64 -> f (Maybe Base64))
-> MessageAttributeValue -> f MessageAttributeValue)
-> ((Maybe ByteString -> f (Maybe ByteString))
-> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> MessageAttributeValue
-> f MessageAttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
(Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64
messageAttributeValue_stringListValues :: Lens.Lens' MessageAttributeValue (Prelude.Maybe [Prelude.Text])
messageAttributeValue_stringListValues :: (Maybe [Text] -> f (Maybe [Text]))
-> MessageAttributeValue -> f MessageAttributeValue
messageAttributeValue_stringListValues = (MessageAttributeValue -> Maybe [Text])
-> (MessageAttributeValue -> Maybe [Text] -> MessageAttributeValue)
-> Lens
MessageAttributeValue
MessageAttributeValue
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageAttributeValue' {Maybe [Text]
stringListValues :: Maybe [Text]
$sel:stringListValues:MessageAttributeValue' :: MessageAttributeValue -> Maybe [Text]
stringListValues} -> Maybe [Text]
stringListValues) (\s :: MessageAttributeValue
s@MessageAttributeValue' {} Maybe [Text]
a -> MessageAttributeValue
s {$sel:stringListValues:MessageAttributeValue' :: Maybe [Text]
stringListValues = Maybe [Text]
a} :: MessageAttributeValue) ((Maybe [Text] -> f (Maybe [Text]))
-> MessageAttributeValue -> f MessageAttributeValue)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> MessageAttributeValue
-> f MessageAttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
messageAttributeValue_stringValue :: Lens.Lens' MessageAttributeValue (Prelude.Maybe Prelude.Text)
messageAttributeValue_stringValue :: (Maybe Text -> f (Maybe Text))
-> MessageAttributeValue -> f MessageAttributeValue
messageAttributeValue_stringValue = (MessageAttributeValue -> Maybe Text)
-> (MessageAttributeValue -> Maybe Text -> MessageAttributeValue)
-> Lens
MessageAttributeValue
MessageAttributeValue
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageAttributeValue' {Maybe Text
stringValue :: Maybe Text
$sel:stringValue:MessageAttributeValue' :: MessageAttributeValue -> Maybe Text
stringValue} -> Maybe Text
stringValue) (\s :: MessageAttributeValue
s@MessageAttributeValue' {} Maybe Text
a -> MessageAttributeValue
s {$sel:stringValue:MessageAttributeValue' :: Maybe Text
stringValue = Maybe Text
a} :: MessageAttributeValue)
messageAttributeValue_binaryListValues :: Lens.Lens' MessageAttributeValue (Prelude.Maybe [Prelude.ByteString])
messageAttributeValue_binaryListValues :: (Maybe [ByteString] -> f (Maybe [ByteString]))
-> MessageAttributeValue -> f MessageAttributeValue
messageAttributeValue_binaryListValues = (MessageAttributeValue -> Maybe [Base64])
-> (MessageAttributeValue
-> Maybe [Base64] -> MessageAttributeValue)
-> Lens
MessageAttributeValue
MessageAttributeValue
(Maybe [Base64])
(Maybe [Base64])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageAttributeValue' {Maybe [Base64]
binaryListValues :: Maybe [Base64]
$sel:binaryListValues:MessageAttributeValue' :: MessageAttributeValue -> Maybe [Base64]
binaryListValues} -> Maybe [Base64]
binaryListValues) (\s :: MessageAttributeValue
s@MessageAttributeValue' {} Maybe [Base64]
a -> MessageAttributeValue
s {$sel:binaryListValues:MessageAttributeValue' :: Maybe [Base64]
binaryListValues = Maybe [Base64]
a} :: MessageAttributeValue) ((Maybe [Base64] -> f (Maybe [Base64]))
-> MessageAttributeValue -> f MessageAttributeValue)
-> ((Maybe [ByteString] -> f (Maybe [ByteString]))
-> Maybe [Base64] -> f (Maybe [Base64]))
-> (Maybe [ByteString] -> f (Maybe [ByteString]))
-> MessageAttributeValue
-> f MessageAttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Base64] [Base64] [ByteString] [ByteString]
-> Iso
(Maybe [Base64])
(Maybe [Base64])
(Maybe [ByteString])
(Maybe [ByteString])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Base64] [Base64] [ByteString] [ByteString]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
messageAttributeValue_dataType :: Lens.Lens' MessageAttributeValue Prelude.Text
messageAttributeValue_dataType :: (Text -> f Text)
-> MessageAttributeValue -> f MessageAttributeValue
messageAttributeValue_dataType = (MessageAttributeValue -> Text)
-> (MessageAttributeValue -> Text -> MessageAttributeValue)
-> Lens MessageAttributeValue MessageAttributeValue Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageAttributeValue' {Text
dataType :: Text
$sel:dataType:MessageAttributeValue' :: MessageAttributeValue -> Text
dataType} -> Text
dataType) (\s :: MessageAttributeValue
s@MessageAttributeValue' {} Text
a -> MessageAttributeValue
s {$sel:dataType:MessageAttributeValue' :: Text
dataType = Text
a} :: MessageAttributeValue)
instance Core.FromXML MessageAttributeValue where
parseXML :: [Node] -> Either String MessageAttributeValue
parseXML [Node]
x =
Maybe Base64
-> Maybe [Text]
-> Maybe Text
-> Maybe [Base64]
-> Text
-> MessageAttributeValue
MessageAttributeValue'
(Maybe Base64
-> Maybe [Text]
-> Maybe Text
-> Maybe [Base64]
-> Text
-> MessageAttributeValue)
-> Either String (Maybe Base64)
-> Either
String
(Maybe [Text]
-> Maybe Text -> Maybe [Base64] -> Text -> MessageAttributeValue)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Base64)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"BinaryValue")
Either
String
(Maybe [Text]
-> Maybe Text -> Maybe [Base64] -> Text -> MessageAttributeValue)
-> Either String (Maybe [Text])
-> Either
String
(Maybe Text -> Maybe [Base64] -> Text -> MessageAttributeValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StringListValue" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"StringListValue")
)
Either
String
(Maybe Text -> Maybe [Base64] -> Text -> MessageAttributeValue)
-> Either String (Maybe Text)
-> Either String (Maybe [Base64] -> Text -> MessageAttributeValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StringValue")
Either String (Maybe [Base64] -> Text -> MessageAttributeValue)
-> Either String (Maybe [Base64])
-> Either String (Text -> MessageAttributeValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"BinaryListValue" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Base64]))
-> Either String (Maybe [Base64])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Base64])
-> [Node] -> Either String (Maybe [Base64])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Base64]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"BinaryListValue")
)
Either String (Text -> MessageAttributeValue)
-> Either String Text -> Either String MessageAttributeValue
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"DataType")
instance Prelude.Hashable MessageAttributeValue
instance Prelude.NFData MessageAttributeValue
instance Core.ToQuery MessageAttributeValue where
toQuery :: MessageAttributeValue -> QueryString
toQuery MessageAttributeValue' {Maybe [Text]
Maybe [Base64]
Maybe Text
Maybe Base64
Text
dataType :: Text
binaryListValues :: Maybe [Base64]
stringValue :: Maybe Text
stringListValues :: Maybe [Text]
binaryValue :: Maybe Base64
$sel:dataType:MessageAttributeValue' :: MessageAttributeValue -> Text
$sel:binaryListValues:MessageAttributeValue' :: MessageAttributeValue -> Maybe [Base64]
$sel:stringValue:MessageAttributeValue' :: MessageAttributeValue -> Maybe Text
$sel:stringListValues:MessageAttributeValue' :: MessageAttributeValue -> Maybe [Text]
$sel:binaryValue:MessageAttributeValue' :: MessageAttributeValue -> Maybe Base64
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"BinaryValue" ByteString -> Maybe Base64 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Base64
binaryValue,
ByteString
"StringListValue"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"StringListValue"
([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
stringListValues
),
ByteString
"StringValue" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
stringValue,
ByteString
"BinaryListValue"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
( ByteString -> [Base64] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"BinaryListValue"
([Base64] -> QueryString) -> Maybe [Base64] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Base64]
binaryListValues
),
ByteString
"DataType" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dataType
]