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