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