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