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