{-# 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.QLDBSession.Types.ValueHolder where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ValueHolder = ValueHolder'
{
ValueHolder -> Maybe Text
ionText :: Prelude.Maybe Prelude.Text,
ValueHolder -> Maybe Base64
ionBinary :: Prelude.Maybe Core.Base64
}
deriving (ValueHolder -> ValueHolder -> Bool
(ValueHolder -> ValueHolder -> Bool)
-> (ValueHolder -> ValueHolder -> Bool) -> Eq ValueHolder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValueHolder -> ValueHolder -> Bool
$c/= :: ValueHolder -> ValueHolder -> Bool
== :: ValueHolder -> ValueHolder -> Bool
$c== :: ValueHolder -> ValueHolder -> Bool
Prelude.Eq, ReadPrec [ValueHolder]
ReadPrec ValueHolder
Int -> ReadS ValueHolder
ReadS [ValueHolder]
(Int -> ReadS ValueHolder)
-> ReadS [ValueHolder]
-> ReadPrec ValueHolder
-> ReadPrec [ValueHolder]
-> Read ValueHolder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValueHolder]
$creadListPrec :: ReadPrec [ValueHolder]
readPrec :: ReadPrec ValueHolder
$creadPrec :: ReadPrec ValueHolder
readList :: ReadS [ValueHolder]
$creadList :: ReadS [ValueHolder]
readsPrec :: Int -> ReadS ValueHolder
$creadsPrec :: Int -> ReadS ValueHolder
Prelude.Read, Int -> ValueHolder -> ShowS
[ValueHolder] -> ShowS
ValueHolder -> String
(Int -> ValueHolder -> ShowS)
-> (ValueHolder -> String)
-> ([ValueHolder] -> ShowS)
-> Show ValueHolder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValueHolder] -> ShowS
$cshowList :: [ValueHolder] -> ShowS
show :: ValueHolder -> String
$cshow :: ValueHolder -> String
showsPrec :: Int -> ValueHolder -> ShowS
$cshowsPrec :: Int -> ValueHolder -> ShowS
Prelude.Show, (forall x. ValueHolder -> Rep ValueHolder x)
-> (forall x. Rep ValueHolder x -> ValueHolder)
-> Generic ValueHolder
forall x. Rep ValueHolder x -> ValueHolder
forall x. ValueHolder -> Rep ValueHolder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ValueHolder x -> ValueHolder
$cfrom :: forall x. ValueHolder -> Rep ValueHolder x
Prelude.Generic)
newValueHolder ::
ValueHolder
newValueHolder :: ValueHolder
newValueHolder =
ValueHolder' :: Maybe Text -> Maybe Base64 -> ValueHolder
ValueHolder'
{ $sel:ionText:ValueHolder' :: Maybe Text
ionText = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:ionBinary:ValueHolder' :: Maybe Base64
ionBinary = Maybe Base64
forall a. Maybe a
Prelude.Nothing
}
valueHolder_ionText :: Lens.Lens' ValueHolder (Prelude.Maybe Prelude.Text)
valueHolder_ionText :: (Maybe Text -> f (Maybe Text)) -> ValueHolder -> f ValueHolder
valueHolder_ionText = (ValueHolder -> Maybe Text)
-> (ValueHolder -> Maybe Text -> ValueHolder)
-> Lens ValueHolder ValueHolder (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValueHolder' {Maybe Text
ionText :: Maybe Text
$sel:ionText:ValueHolder' :: ValueHolder -> Maybe Text
ionText} -> Maybe Text
ionText) (\s :: ValueHolder
s@ValueHolder' {} Maybe Text
a -> ValueHolder
s {$sel:ionText:ValueHolder' :: Maybe Text
ionText = Maybe Text
a} :: ValueHolder)
valueHolder_ionBinary :: Lens.Lens' ValueHolder (Prelude.Maybe Prelude.ByteString)
valueHolder_ionBinary :: (Maybe ByteString -> f (Maybe ByteString))
-> ValueHolder -> f ValueHolder
valueHolder_ionBinary = (ValueHolder -> Maybe Base64)
-> (ValueHolder -> Maybe Base64 -> ValueHolder)
-> Lens ValueHolder ValueHolder (Maybe Base64) (Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValueHolder' {Maybe Base64
ionBinary :: Maybe Base64
$sel:ionBinary:ValueHolder' :: ValueHolder -> Maybe Base64
ionBinary} -> Maybe Base64
ionBinary) (\s :: ValueHolder
s@ValueHolder' {} Maybe Base64
a -> ValueHolder
s {$sel:ionBinary:ValueHolder' :: Maybe Base64
ionBinary = Maybe Base64
a} :: ValueHolder) ((Maybe Base64 -> f (Maybe Base64))
-> ValueHolder -> f ValueHolder)
-> ((Maybe ByteString -> f (Maybe ByteString))
-> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> ValueHolder
-> f ValueHolder
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
instance Core.FromJSON ValueHolder where
parseJSON :: Value -> Parser ValueHolder
parseJSON =
String
-> (Object -> Parser ValueHolder) -> Value -> Parser ValueHolder
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ValueHolder"
( \Object
x ->
Maybe Text -> Maybe Base64 -> ValueHolder
ValueHolder'
(Maybe Text -> Maybe Base64 -> ValueHolder)
-> Parser (Maybe Text) -> Parser (Maybe Base64 -> ValueHolder)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IonText")
Parser (Maybe Base64 -> ValueHolder)
-> Parser (Maybe Base64) -> Parser ValueHolder
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Base64)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IonBinary")
)
instance Prelude.Hashable ValueHolder
instance Prelude.NFData ValueHolder
instance Core.ToJSON ValueHolder where
toJSON :: ValueHolder -> Value
toJSON ValueHolder' {Maybe Text
Maybe Base64
ionBinary :: Maybe Base64
ionText :: Maybe Text
$sel:ionBinary:ValueHolder' :: ValueHolder -> Maybe Base64
$sel:ionText:ValueHolder' :: ValueHolder -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"IonText" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ionText,
(Text
"IonBinary" Text -> Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Base64 -> Pair) -> Maybe Base64 -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Base64
ionBinary
]
)