{-# 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.DLM.Types.EventParameters where
import qualified Amazonka.Core as Core
import Amazonka.DLM.Types.EventTypeValues
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EventParameters = EventParameters'
{
EventParameters -> EventTypeValues
eventType :: EventTypeValues,
EventParameters -> [Text]
snapshotOwner :: [Prelude.Text],
EventParameters -> Text
descriptionRegex :: Prelude.Text
}
deriving (EventParameters -> EventParameters -> Bool
(EventParameters -> EventParameters -> Bool)
-> (EventParameters -> EventParameters -> Bool)
-> Eq EventParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventParameters -> EventParameters -> Bool
$c/= :: EventParameters -> EventParameters -> Bool
== :: EventParameters -> EventParameters -> Bool
$c== :: EventParameters -> EventParameters -> Bool
Prelude.Eq, ReadPrec [EventParameters]
ReadPrec EventParameters
Int -> ReadS EventParameters
ReadS [EventParameters]
(Int -> ReadS EventParameters)
-> ReadS [EventParameters]
-> ReadPrec EventParameters
-> ReadPrec [EventParameters]
-> Read EventParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventParameters]
$creadListPrec :: ReadPrec [EventParameters]
readPrec :: ReadPrec EventParameters
$creadPrec :: ReadPrec EventParameters
readList :: ReadS [EventParameters]
$creadList :: ReadS [EventParameters]
readsPrec :: Int -> ReadS EventParameters
$creadsPrec :: Int -> ReadS EventParameters
Prelude.Read, Int -> EventParameters -> ShowS
[EventParameters] -> ShowS
EventParameters -> String
(Int -> EventParameters -> ShowS)
-> (EventParameters -> String)
-> ([EventParameters] -> ShowS)
-> Show EventParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventParameters] -> ShowS
$cshowList :: [EventParameters] -> ShowS
show :: EventParameters -> String
$cshow :: EventParameters -> String
showsPrec :: Int -> EventParameters -> ShowS
$cshowsPrec :: Int -> EventParameters -> ShowS
Prelude.Show, (forall x. EventParameters -> Rep EventParameters x)
-> (forall x. Rep EventParameters x -> EventParameters)
-> Generic EventParameters
forall x. Rep EventParameters x -> EventParameters
forall x. EventParameters -> Rep EventParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventParameters x -> EventParameters
$cfrom :: forall x. EventParameters -> Rep EventParameters x
Prelude.Generic)
newEventParameters ::
EventTypeValues ->
Prelude.Text ->
EventParameters
newEventParameters :: EventTypeValues -> Text -> EventParameters
newEventParameters EventTypeValues
pEventType_ Text
pDescriptionRegex_ =
EventParameters' :: EventTypeValues -> [Text] -> Text -> EventParameters
EventParameters'
{ $sel:eventType:EventParameters' :: EventTypeValues
eventType = EventTypeValues
pEventType_,
$sel:snapshotOwner:EventParameters' :: [Text]
snapshotOwner = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:descriptionRegex:EventParameters' :: Text
descriptionRegex = Text
pDescriptionRegex_
}
eventParameters_eventType :: Lens.Lens' EventParameters EventTypeValues
eventParameters_eventType :: (EventTypeValues -> f EventTypeValues)
-> EventParameters -> f EventParameters
eventParameters_eventType = (EventParameters -> EventTypeValues)
-> (EventParameters -> EventTypeValues -> EventParameters)
-> Lens
EventParameters EventParameters EventTypeValues EventTypeValues
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventParameters' {EventTypeValues
eventType :: EventTypeValues
$sel:eventType:EventParameters' :: EventParameters -> EventTypeValues
eventType} -> EventTypeValues
eventType) (\s :: EventParameters
s@EventParameters' {} EventTypeValues
a -> EventParameters
s {$sel:eventType:EventParameters' :: EventTypeValues
eventType = EventTypeValues
a} :: EventParameters)
eventParameters_snapshotOwner :: Lens.Lens' EventParameters [Prelude.Text]
eventParameters_snapshotOwner :: ([Text] -> f [Text]) -> EventParameters -> f EventParameters
eventParameters_snapshotOwner = (EventParameters -> [Text])
-> (EventParameters -> [Text] -> EventParameters)
-> Lens EventParameters EventParameters [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventParameters' {[Text]
snapshotOwner :: [Text]
$sel:snapshotOwner:EventParameters' :: EventParameters -> [Text]
snapshotOwner} -> [Text]
snapshotOwner) (\s :: EventParameters
s@EventParameters' {} [Text]
a -> EventParameters
s {$sel:snapshotOwner:EventParameters' :: [Text]
snapshotOwner = [Text]
a} :: EventParameters) (([Text] -> f [Text]) -> EventParameters -> f EventParameters)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> EventParameters
-> f EventParameters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
eventParameters_descriptionRegex :: Lens.Lens' EventParameters Prelude.Text
eventParameters_descriptionRegex :: (Text -> f Text) -> EventParameters -> f EventParameters
eventParameters_descriptionRegex = (EventParameters -> Text)
-> (EventParameters -> Text -> EventParameters)
-> Lens EventParameters EventParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventParameters' {Text
descriptionRegex :: Text
$sel:descriptionRegex:EventParameters' :: EventParameters -> Text
descriptionRegex} -> Text
descriptionRegex) (\s :: EventParameters
s@EventParameters' {} Text
a -> EventParameters
s {$sel:descriptionRegex:EventParameters' :: Text
descriptionRegex = Text
a} :: EventParameters)
instance Core.FromJSON EventParameters where
parseJSON :: Value -> Parser EventParameters
parseJSON =
String
-> (Object -> Parser EventParameters)
-> Value
-> Parser EventParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EventParameters"
( \Object
x ->
EventTypeValues -> [Text] -> Text -> EventParameters
EventParameters'
(EventTypeValues -> [Text] -> Text -> EventParameters)
-> Parser EventTypeValues
-> Parser ([Text] -> Text -> EventParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser EventTypeValues
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EventType")
Parser ([Text] -> Text -> EventParameters)
-> Parser [Text] -> Parser (Text -> EventParameters)
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
"SnapshotOwner" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> EventParameters)
-> Parser Text -> Parser EventParameters
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
"DescriptionRegex")
)
instance Prelude.Hashable EventParameters
instance Prelude.NFData EventParameters
instance Core.ToJSON EventParameters where
toJSON :: EventParameters -> Value
toJSON EventParameters' {[Text]
Text
EventTypeValues
descriptionRegex :: Text
snapshotOwner :: [Text]
eventType :: EventTypeValues
$sel:descriptionRegex:EventParameters' :: EventParameters -> Text
$sel:snapshotOwner:EventParameters' :: EventParameters -> [Text]
$sel:eventType:EventParameters' :: EventParameters -> EventTypeValues
..} =
[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
"EventType" Text -> EventTypeValues -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= EventTypeValues
eventType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SnapshotOwner" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
snapshotOwner),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DescriptionRegex" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
descriptionRegex)
]
)