{-# 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.Comprehend.Types.InputDataConfig where
import Amazonka.Comprehend.Types.DocumentReaderConfig
import Amazonka.Comprehend.Types.InputFormat
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InputDataConfig = InputDataConfig'
{
InputDataConfig -> Maybe DocumentReaderConfig
documentReaderConfig :: Prelude.Maybe DocumentReaderConfig,
InputDataConfig -> Maybe InputFormat
inputFormat :: Prelude.Maybe InputFormat,
InputDataConfig -> Text
s3Uri :: Prelude.Text
}
deriving (InputDataConfig -> InputDataConfig -> Bool
(InputDataConfig -> InputDataConfig -> Bool)
-> (InputDataConfig -> InputDataConfig -> Bool)
-> Eq InputDataConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputDataConfig -> InputDataConfig -> Bool
$c/= :: InputDataConfig -> InputDataConfig -> Bool
== :: InputDataConfig -> InputDataConfig -> Bool
$c== :: InputDataConfig -> InputDataConfig -> Bool
Prelude.Eq, ReadPrec [InputDataConfig]
ReadPrec InputDataConfig
Int -> ReadS InputDataConfig
ReadS [InputDataConfig]
(Int -> ReadS InputDataConfig)
-> ReadS [InputDataConfig]
-> ReadPrec InputDataConfig
-> ReadPrec [InputDataConfig]
-> Read InputDataConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputDataConfig]
$creadListPrec :: ReadPrec [InputDataConfig]
readPrec :: ReadPrec InputDataConfig
$creadPrec :: ReadPrec InputDataConfig
readList :: ReadS [InputDataConfig]
$creadList :: ReadS [InputDataConfig]
readsPrec :: Int -> ReadS InputDataConfig
$creadsPrec :: Int -> ReadS InputDataConfig
Prelude.Read, Int -> InputDataConfig -> ShowS
[InputDataConfig] -> ShowS
InputDataConfig -> String
(Int -> InputDataConfig -> ShowS)
-> (InputDataConfig -> String)
-> ([InputDataConfig] -> ShowS)
-> Show InputDataConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputDataConfig] -> ShowS
$cshowList :: [InputDataConfig] -> ShowS
show :: InputDataConfig -> String
$cshow :: InputDataConfig -> String
showsPrec :: Int -> InputDataConfig -> ShowS
$cshowsPrec :: Int -> InputDataConfig -> ShowS
Prelude.Show, (forall x. InputDataConfig -> Rep InputDataConfig x)
-> (forall x. Rep InputDataConfig x -> InputDataConfig)
-> Generic InputDataConfig
forall x. Rep InputDataConfig x -> InputDataConfig
forall x. InputDataConfig -> Rep InputDataConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputDataConfig x -> InputDataConfig
$cfrom :: forall x. InputDataConfig -> Rep InputDataConfig x
Prelude.Generic)
newInputDataConfig ::
Prelude.Text ->
InputDataConfig
newInputDataConfig :: Text -> InputDataConfig
newInputDataConfig Text
pS3Uri_ =
InputDataConfig' :: Maybe DocumentReaderConfig
-> Maybe InputFormat -> Text -> InputDataConfig
InputDataConfig'
{ $sel:documentReaderConfig:InputDataConfig' :: Maybe DocumentReaderConfig
documentReaderConfig =
Maybe DocumentReaderConfig
forall a. Maybe a
Prelude.Nothing,
$sel:inputFormat:InputDataConfig' :: Maybe InputFormat
inputFormat = Maybe InputFormat
forall a. Maybe a
Prelude.Nothing,
$sel:s3Uri:InputDataConfig' :: Text
s3Uri = Text
pS3Uri_
}
inputDataConfig_documentReaderConfig :: Lens.Lens' InputDataConfig (Prelude.Maybe DocumentReaderConfig)
inputDataConfig_documentReaderConfig :: (Maybe DocumentReaderConfig -> f (Maybe DocumentReaderConfig))
-> InputDataConfig -> f InputDataConfig
inputDataConfig_documentReaderConfig = (InputDataConfig -> Maybe DocumentReaderConfig)
-> (InputDataConfig
-> Maybe DocumentReaderConfig -> InputDataConfig)
-> Lens
InputDataConfig
InputDataConfig
(Maybe DocumentReaderConfig)
(Maybe DocumentReaderConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Maybe DocumentReaderConfig
documentReaderConfig :: Maybe DocumentReaderConfig
$sel:documentReaderConfig:InputDataConfig' :: InputDataConfig -> Maybe DocumentReaderConfig
documentReaderConfig} -> Maybe DocumentReaderConfig
documentReaderConfig) (\s :: InputDataConfig
s@InputDataConfig' {} Maybe DocumentReaderConfig
a -> InputDataConfig
s {$sel:documentReaderConfig:InputDataConfig' :: Maybe DocumentReaderConfig
documentReaderConfig = Maybe DocumentReaderConfig
a} :: InputDataConfig)
inputDataConfig_inputFormat :: Lens.Lens' InputDataConfig (Prelude.Maybe InputFormat)
inputDataConfig_inputFormat :: (Maybe InputFormat -> f (Maybe InputFormat))
-> InputDataConfig -> f InputDataConfig
inputDataConfig_inputFormat = (InputDataConfig -> Maybe InputFormat)
-> (InputDataConfig -> Maybe InputFormat -> InputDataConfig)
-> Lens
InputDataConfig
InputDataConfig
(Maybe InputFormat)
(Maybe InputFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Maybe InputFormat
inputFormat :: Maybe InputFormat
$sel:inputFormat:InputDataConfig' :: InputDataConfig -> Maybe InputFormat
inputFormat} -> Maybe InputFormat
inputFormat) (\s :: InputDataConfig
s@InputDataConfig' {} Maybe InputFormat
a -> InputDataConfig
s {$sel:inputFormat:InputDataConfig' :: Maybe InputFormat
inputFormat = Maybe InputFormat
a} :: InputDataConfig)
inputDataConfig_s3Uri :: Lens.Lens' InputDataConfig Prelude.Text
inputDataConfig_s3Uri :: (Text -> f Text) -> InputDataConfig -> f InputDataConfig
inputDataConfig_s3Uri = (InputDataConfig -> Text)
-> (InputDataConfig -> Text -> InputDataConfig)
-> Lens InputDataConfig InputDataConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Text
s3Uri :: Text
$sel:s3Uri:InputDataConfig' :: InputDataConfig -> Text
s3Uri} -> Text
s3Uri) (\s :: InputDataConfig
s@InputDataConfig' {} Text
a -> InputDataConfig
s {$sel:s3Uri:InputDataConfig' :: Text
s3Uri = Text
a} :: InputDataConfig)
instance Core.FromJSON InputDataConfig where
parseJSON :: Value -> Parser InputDataConfig
parseJSON =
String
-> (Object -> Parser InputDataConfig)
-> Value
-> Parser InputDataConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InputDataConfig"
( \Object
x ->
Maybe DocumentReaderConfig
-> Maybe InputFormat -> Text -> InputDataConfig
InputDataConfig'
(Maybe DocumentReaderConfig
-> Maybe InputFormat -> Text -> InputDataConfig)
-> Parser (Maybe DocumentReaderConfig)
-> Parser (Maybe InputFormat -> Text -> InputDataConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DocumentReaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DocumentReaderConfig")
Parser (Maybe InputFormat -> Text -> InputDataConfig)
-> Parser (Maybe InputFormat) -> Parser (Text -> InputDataConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InputFormat)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InputFormat")
Parser (Text -> InputDataConfig)
-> Parser Text -> Parser InputDataConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Uri")
)
instance Prelude.Hashable InputDataConfig
instance Prelude.NFData InputDataConfig
instance Core.ToJSON InputDataConfig where
toJSON :: InputDataConfig -> Value
toJSON InputDataConfig' {Maybe DocumentReaderConfig
Maybe InputFormat
Text
s3Uri :: Text
inputFormat :: Maybe InputFormat
documentReaderConfig :: Maybe DocumentReaderConfig
$sel:s3Uri:InputDataConfig' :: InputDataConfig -> Text
$sel:inputFormat:InputDataConfig' :: InputDataConfig -> Maybe InputFormat
$sel:documentReaderConfig:InputDataConfig' :: InputDataConfig -> Maybe DocumentReaderConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DocumentReaderConfig" Text -> DocumentReaderConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DocumentReaderConfig -> Pair)
-> Maybe DocumentReaderConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DocumentReaderConfig
documentReaderConfig,
(Text
"InputFormat" Text -> InputFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (InputFormat -> Pair) -> Maybe InputFormat -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputFormat
inputFormat,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Uri)
]
)