{-# 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.QLDB.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 (Sensitive Text)
ionText :: Prelude.Maybe (Core.Sensitive Prelude.Text)
}
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, 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 (Sensitive Text) -> ValueHolder
ValueHolder' {$sel:ionText:ValueHolder' :: Maybe (Sensitive Text)
ionText = Maybe (Sensitive Text)
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 (Sensitive Text))
-> (ValueHolder -> Maybe (Sensitive Text) -> ValueHolder)
-> Lens
ValueHolder
ValueHolder
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValueHolder' {Maybe (Sensitive Text)
ionText :: Maybe (Sensitive Text)
$sel:ionText:ValueHolder' :: ValueHolder -> Maybe (Sensitive Text)
ionText} -> Maybe (Sensitive Text)
ionText) (\s :: ValueHolder
s@ValueHolder' {} Maybe (Sensitive Text)
a -> ValueHolder
s {$sel:ionText:ValueHolder' :: Maybe (Sensitive Text)
ionText = Maybe (Sensitive Text)
a} :: ValueHolder) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> ValueHolder -> f ValueHolder)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ValueHolder
-> f ValueHolder
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
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 (Sensitive Text) -> ValueHolder
ValueHolder' (Maybe (Sensitive Text) -> ValueHolder)
-> Parser (Maybe (Sensitive Text)) -> Parser ValueHolder
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IonText")
)
instance Prelude.Hashable ValueHolder
instance Prelude.NFData ValueHolder
instance Core.ToJSON ValueHolder where
toJSON :: ValueHolder -> Value
toJSON ValueHolder' {Maybe (Sensitive Text)
ionText :: Maybe (Sensitive Text)
$sel:ionText:ValueHolder' :: ValueHolder -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"IonText" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
ionText]
)