{-# 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.Kendra.Types.DocumentAttributeValue where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data DocumentAttributeValue = DocumentAttributeValue'
{
DocumentAttributeValue -> Maybe POSIX
dateValue :: Prelude.Maybe Data.POSIX,
DocumentAttributeValue -> Maybe Integer
longValue :: Prelude.Maybe Prelude.Integer,
DocumentAttributeValue -> Maybe [Text]
stringListValue :: Prelude.Maybe [Prelude.Text],
DocumentAttributeValue -> Maybe Text
stringValue :: Prelude.Maybe Prelude.Text
}
deriving (DocumentAttributeValue -> DocumentAttributeValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentAttributeValue -> DocumentAttributeValue -> Bool
$c/= :: DocumentAttributeValue -> DocumentAttributeValue -> Bool
== :: DocumentAttributeValue -> DocumentAttributeValue -> Bool
$c== :: DocumentAttributeValue -> DocumentAttributeValue -> Bool
Prelude.Eq, ReadPrec [DocumentAttributeValue]
ReadPrec DocumentAttributeValue
Int -> ReadS DocumentAttributeValue
ReadS [DocumentAttributeValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentAttributeValue]
$creadListPrec :: ReadPrec [DocumentAttributeValue]
readPrec :: ReadPrec DocumentAttributeValue
$creadPrec :: ReadPrec DocumentAttributeValue
readList :: ReadS [DocumentAttributeValue]
$creadList :: ReadS [DocumentAttributeValue]
readsPrec :: Int -> ReadS DocumentAttributeValue
$creadsPrec :: Int -> ReadS DocumentAttributeValue
Prelude.Read, Int -> DocumentAttributeValue -> ShowS
[DocumentAttributeValue] -> ShowS
DocumentAttributeValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentAttributeValue] -> ShowS
$cshowList :: [DocumentAttributeValue] -> ShowS
show :: DocumentAttributeValue -> String
$cshow :: DocumentAttributeValue -> String
showsPrec :: Int -> DocumentAttributeValue -> ShowS
$cshowsPrec :: Int -> DocumentAttributeValue -> ShowS
Prelude.Show, forall x. Rep DocumentAttributeValue x -> DocumentAttributeValue
forall x. DocumentAttributeValue -> Rep DocumentAttributeValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DocumentAttributeValue x -> DocumentAttributeValue
$cfrom :: forall x. DocumentAttributeValue -> Rep DocumentAttributeValue x
Prelude.Generic)
newDocumentAttributeValue ::
DocumentAttributeValue
newDocumentAttributeValue :: DocumentAttributeValue
newDocumentAttributeValue =
DocumentAttributeValue'
{ $sel:dateValue:DocumentAttributeValue' :: Maybe POSIX
dateValue =
forall a. Maybe a
Prelude.Nothing,
$sel:longValue:DocumentAttributeValue' :: Maybe Integer
longValue = forall a. Maybe a
Prelude.Nothing,
$sel:stringListValue:DocumentAttributeValue' :: Maybe [Text]
stringListValue = forall a. Maybe a
Prelude.Nothing,
$sel:stringValue:DocumentAttributeValue' :: Maybe Text
stringValue = forall a. Maybe a
Prelude.Nothing
}
documentAttributeValue_dateValue :: Lens.Lens' DocumentAttributeValue (Prelude.Maybe Prelude.UTCTime)
documentAttributeValue_dateValue :: Lens' DocumentAttributeValue (Maybe UTCTime)
documentAttributeValue_dateValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentAttributeValue' {Maybe POSIX
dateValue :: Maybe POSIX
$sel:dateValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe POSIX
dateValue} -> Maybe POSIX
dateValue) (\s :: DocumentAttributeValue
s@DocumentAttributeValue' {} Maybe POSIX
a -> DocumentAttributeValue
s {$sel:dateValue:DocumentAttributeValue' :: Maybe POSIX
dateValue = Maybe POSIX
a} :: DocumentAttributeValue) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
documentAttributeValue_longValue :: Lens.Lens' DocumentAttributeValue (Prelude.Maybe Prelude.Integer)
documentAttributeValue_longValue :: Lens' DocumentAttributeValue (Maybe Integer)
documentAttributeValue_longValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentAttributeValue' {Maybe Integer
longValue :: Maybe Integer
$sel:longValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe Integer
longValue} -> Maybe Integer
longValue) (\s :: DocumentAttributeValue
s@DocumentAttributeValue' {} Maybe Integer
a -> DocumentAttributeValue
s {$sel:longValue:DocumentAttributeValue' :: Maybe Integer
longValue = Maybe Integer
a} :: DocumentAttributeValue)
documentAttributeValue_stringListValue :: Lens.Lens' DocumentAttributeValue (Prelude.Maybe [Prelude.Text])
documentAttributeValue_stringListValue :: Lens' DocumentAttributeValue (Maybe [Text])
documentAttributeValue_stringListValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentAttributeValue' {Maybe [Text]
stringListValue :: Maybe [Text]
$sel:stringListValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe [Text]
stringListValue} -> Maybe [Text]
stringListValue) (\s :: DocumentAttributeValue
s@DocumentAttributeValue' {} Maybe [Text]
a -> DocumentAttributeValue
s {$sel:stringListValue:DocumentAttributeValue' :: Maybe [Text]
stringListValue = Maybe [Text]
a} :: DocumentAttributeValue) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
documentAttributeValue_stringValue :: Lens.Lens' DocumentAttributeValue (Prelude.Maybe Prelude.Text)
documentAttributeValue_stringValue :: Lens' DocumentAttributeValue (Maybe Text)
documentAttributeValue_stringValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentAttributeValue' {Maybe Text
stringValue :: Maybe Text
$sel:stringValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe Text
stringValue} -> Maybe Text
stringValue) (\s :: DocumentAttributeValue
s@DocumentAttributeValue' {} Maybe Text
a -> DocumentAttributeValue
s {$sel:stringValue:DocumentAttributeValue' :: Maybe Text
stringValue = Maybe Text
a} :: DocumentAttributeValue)
instance Data.FromJSON DocumentAttributeValue where
parseJSON :: Value -> Parser DocumentAttributeValue
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DocumentAttributeValue"
( \Object
x ->
Maybe POSIX
-> Maybe Integer
-> Maybe [Text]
-> Maybe Text
-> DocumentAttributeValue
DocumentAttributeValue'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DateValue")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LongValue")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StringListValue"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StringValue")
)
instance Prelude.Hashable DocumentAttributeValue where
hashWithSalt :: Int -> DocumentAttributeValue -> Int
hashWithSalt Int
_salt DocumentAttributeValue' {Maybe Integer
Maybe [Text]
Maybe Text
Maybe POSIX
stringValue :: Maybe Text
stringListValue :: Maybe [Text]
longValue :: Maybe Integer
dateValue :: Maybe POSIX
$sel:stringValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe Text
$sel:stringListValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe [Text]
$sel:longValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe Integer
$sel:dateValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe POSIX
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
dateValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
longValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
stringListValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stringValue
instance Prelude.NFData DocumentAttributeValue where
rnf :: DocumentAttributeValue -> ()
rnf DocumentAttributeValue' {Maybe Integer
Maybe [Text]
Maybe Text
Maybe POSIX
stringValue :: Maybe Text
stringListValue :: Maybe [Text]
longValue :: Maybe Integer
dateValue :: Maybe POSIX
$sel:stringValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe Text
$sel:stringListValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe [Text]
$sel:longValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe Integer
$sel:dateValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe POSIX
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
dateValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
longValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
stringListValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stringValue
instance Data.ToJSON DocumentAttributeValue where
toJSON :: DocumentAttributeValue -> Value
toJSON DocumentAttributeValue' {Maybe Integer
Maybe [Text]
Maybe Text
Maybe POSIX
stringValue :: Maybe Text
stringListValue :: Maybe [Text]
longValue :: Maybe Integer
dateValue :: Maybe POSIX
$sel:stringValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe Text
$sel:stringListValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe [Text]
$sel:longValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe Integer
$sel:dateValue:DocumentAttributeValue' :: DocumentAttributeValue -> Maybe POSIX
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DateValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
dateValue,
(Key
"LongValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
longValue,
(Key
"StringListValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
stringListValue,
(Key
"StringValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
stringValue
]
)