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