{-# 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.SESV2.Types.ImportDataSource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SESV2.Types.DataFormat
data ImportDataSource = ImportDataSource'
{
ImportDataSource -> Text
s3Url :: Prelude.Text,
ImportDataSource -> DataFormat
dataFormat :: DataFormat
}
deriving (ImportDataSource -> ImportDataSource -> Bool
(ImportDataSource -> ImportDataSource -> Bool)
-> (ImportDataSource -> ImportDataSource -> Bool)
-> Eq ImportDataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportDataSource -> ImportDataSource -> Bool
$c/= :: ImportDataSource -> ImportDataSource -> Bool
== :: ImportDataSource -> ImportDataSource -> Bool
$c== :: ImportDataSource -> ImportDataSource -> Bool
Prelude.Eq, ReadPrec [ImportDataSource]
ReadPrec ImportDataSource
Int -> ReadS ImportDataSource
ReadS [ImportDataSource]
(Int -> ReadS ImportDataSource)
-> ReadS [ImportDataSource]
-> ReadPrec ImportDataSource
-> ReadPrec [ImportDataSource]
-> Read ImportDataSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportDataSource]
$creadListPrec :: ReadPrec [ImportDataSource]
readPrec :: ReadPrec ImportDataSource
$creadPrec :: ReadPrec ImportDataSource
readList :: ReadS [ImportDataSource]
$creadList :: ReadS [ImportDataSource]
readsPrec :: Int -> ReadS ImportDataSource
$creadsPrec :: Int -> ReadS ImportDataSource
Prelude.Read, Int -> ImportDataSource -> ShowS
[ImportDataSource] -> ShowS
ImportDataSource -> String
(Int -> ImportDataSource -> ShowS)
-> (ImportDataSource -> String)
-> ([ImportDataSource] -> ShowS)
-> Show ImportDataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportDataSource] -> ShowS
$cshowList :: [ImportDataSource] -> ShowS
show :: ImportDataSource -> String
$cshow :: ImportDataSource -> String
showsPrec :: Int -> ImportDataSource -> ShowS
$cshowsPrec :: Int -> ImportDataSource -> ShowS
Prelude.Show, (forall x. ImportDataSource -> Rep ImportDataSource x)
-> (forall x. Rep ImportDataSource x -> ImportDataSource)
-> Generic ImportDataSource
forall x. Rep ImportDataSource x -> ImportDataSource
forall x. ImportDataSource -> Rep ImportDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportDataSource x -> ImportDataSource
$cfrom :: forall x. ImportDataSource -> Rep ImportDataSource x
Prelude.Generic)
newImportDataSource ::
Prelude.Text ->
DataFormat ->
ImportDataSource
newImportDataSource :: Text -> DataFormat -> ImportDataSource
newImportDataSource Text
pS3Url_ DataFormat
pDataFormat_ =
ImportDataSource' :: Text -> DataFormat -> ImportDataSource
ImportDataSource'
{ $sel:s3Url:ImportDataSource' :: Text
s3Url = Text
pS3Url_,
$sel:dataFormat:ImportDataSource' :: DataFormat
dataFormat = DataFormat
pDataFormat_
}
importDataSource_s3Url :: Lens.Lens' ImportDataSource Prelude.Text
importDataSource_s3Url :: (Text -> f Text) -> ImportDataSource -> f ImportDataSource
importDataSource_s3Url = (ImportDataSource -> Text)
-> (ImportDataSource -> Text -> ImportDataSource)
-> Lens ImportDataSource ImportDataSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportDataSource' {Text
s3Url :: Text
$sel:s3Url:ImportDataSource' :: ImportDataSource -> Text
s3Url} -> Text
s3Url) (\s :: ImportDataSource
s@ImportDataSource' {} Text
a -> ImportDataSource
s {$sel:s3Url:ImportDataSource' :: Text
s3Url = Text
a} :: ImportDataSource)
importDataSource_dataFormat :: Lens.Lens' ImportDataSource DataFormat
importDataSource_dataFormat :: (DataFormat -> f DataFormat)
-> ImportDataSource -> f ImportDataSource
importDataSource_dataFormat = (ImportDataSource -> DataFormat)
-> (ImportDataSource -> DataFormat -> ImportDataSource)
-> Lens ImportDataSource ImportDataSource DataFormat DataFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportDataSource' {DataFormat
dataFormat :: DataFormat
$sel:dataFormat:ImportDataSource' :: ImportDataSource -> DataFormat
dataFormat} -> DataFormat
dataFormat) (\s :: ImportDataSource
s@ImportDataSource' {} DataFormat
a -> ImportDataSource
s {$sel:dataFormat:ImportDataSource' :: DataFormat
dataFormat = DataFormat
a} :: ImportDataSource)
instance Core.FromJSON ImportDataSource where
parseJSON :: Value -> Parser ImportDataSource
parseJSON =
String
-> (Object -> Parser ImportDataSource)
-> Value
-> Parser ImportDataSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ImportDataSource"
( \Object
x ->
Text -> DataFormat -> ImportDataSource
ImportDataSource'
(Text -> DataFormat -> ImportDataSource)
-> Parser Text -> Parser (DataFormat -> ImportDataSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Url")
Parser (DataFormat -> ImportDataSource)
-> Parser DataFormat -> Parser ImportDataSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DataFormat
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DataFormat")
)
instance Prelude.Hashable ImportDataSource
instance Prelude.NFData ImportDataSource
instance Core.ToJSON ImportDataSource where
toJSON :: ImportDataSource -> Value
toJSON ImportDataSource' {Text
DataFormat
dataFormat :: DataFormat
s3Url :: Text
$sel:dataFormat:ImportDataSource' :: ImportDataSource -> DataFormat
$sel:s3Url:ImportDataSource' :: ImportDataSource -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Url),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DataFormat" Text -> DataFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataFormat
dataFormat)
]
)