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