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