{-# 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.MediaLive.Types.RenewalSettings where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.ReservationAutomaticRenewal
import qualified Amazonka.Prelude as Prelude
data RenewalSettings = RenewalSettings'
{
RenewalSettings -> Maybe ReservationAutomaticRenewal
automaticRenewal :: Prelude.Maybe ReservationAutomaticRenewal,
RenewalSettings -> Maybe Natural
renewalCount :: Prelude.Maybe Prelude.Natural
}
deriving (RenewalSettings -> RenewalSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenewalSettings -> RenewalSettings -> Bool
$c/= :: RenewalSettings -> RenewalSettings -> Bool
== :: RenewalSettings -> RenewalSettings -> Bool
$c== :: RenewalSettings -> RenewalSettings -> Bool
Prelude.Eq, ReadPrec [RenewalSettings]
ReadPrec RenewalSettings
Int -> ReadS RenewalSettings
ReadS [RenewalSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RenewalSettings]
$creadListPrec :: ReadPrec [RenewalSettings]
readPrec :: ReadPrec RenewalSettings
$creadPrec :: ReadPrec RenewalSettings
readList :: ReadS [RenewalSettings]
$creadList :: ReadS [RenewalSettings]
readsPrec :: Int -> ReadS RenewalSettings
$creadsPrec :: Int -> ReadS RenewalSettings
Prelude.Read, Int -> RenewalSettings -> ShowS
[RenewalSettings] -> ShowS
RenewalSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenewalSettings] -> ShowS
$cshowList :: [RenewalSettings] -> ShowS
show :: RenewalSettings -> String
$cshow :: RenewalSettings -> String
showsPrec :: Int -> RenewalSettings -> ShowS
$cshowsPrec :: Int -> RenewalSettings -> ShowS
Prelude.Show, forall x. Rep RenewalSettings x -> RenewalSettings
forall x. RenewalSettings -> Rep RenewalSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RenewalSettings x -> RenewalSettings
$cfrom :: forall x. RenewalSettings -> Rep RenewalSettings x
Prelude.Generic)
newRenewalSettings ::
RenewalSettings
newRenewalSettings :: RenewalSettings
newRenewalSettings =
RenewalSettings'
{ $sel:automaticRenewal:RenewalSettings' :: Maybe ReservationAutomaticRenewal
automaticRenewal =
forall a. Maybe a
Prelude.Nothing,
$sel:renewalCount:RenewalSettings' :: Maybe Natural
renewalCount = forall a. Maybe a
Prelude.Nothing
}
renewalSettings_automaticRenewal :: Lens.Lens' RenewalSettings (Prelude.Maybe ReservationAutomaticRenewal)
renewalSettings_automaticRenewal :: Lens' RenewalSettings (Maybe ReservationAutomaticRenewal)
renewalSettings_automaticRenewal = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenewalSettings' {Maybe ReservationAutomaticRenewal
automaticRenewal :: Maybe ReservationAutomaticRenewal
$sel:automaticRenewal:RenewalSettings' :: RenewalSettings -> Maybe ReservationAutomaticRenewal
automaticRenewal} -> Maybe ReservationAutomaticRenewal
automaticRenewal) (\s :: RenewalSettings
s@RenewalSettings' {} Maybe ReservationAutomaticRenewal
a -> RenewalSettings
s {$sel:automaticRenewal:RenewalSettings' :: Maybe ReservationAutomaticRenewal
automaticRenewal = Maybe ReservationAutomaticRenewal
a} :: RenewalSettings)
renewalSettings_renewalCount :: Lens.Lens' RenewalSettings (Prelude.Maybe Prelude.Natural)
renewalSettings_renewalCount :: Lens' RenewalSettings (Maybe Natural)
renewalSettings_renewalCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenewalSettings' {Maybe Natural
renewalCount :: Maybe Natural
$sel:renewalCount:RenewalSettings' :: RenewalSettings -> Maybe Natural
renewalCount} -> Maybe Natural
renewalCount) (\s :: RenewalSettings
s@RenewalSettings' {} Maybe Natural
a -> RenewalSettings
s {$sel:renewalCount:RenewalSettings' :: Maybe Natural
renewalCount = Maybe Natural
a} :: RenewalSettings)
instance Data.FromJSON RenewalSettings where
parseJSON :: Value -> Parser RenewalSettings
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RenewalSettings"
( \Object
x ->
Maybe ReservationAutomaticRenewal
-> Maybe Natural -> RenewalSettings
RenewalSettings'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"automaticRenewal")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"renewalCount")
)
instance Prelude.Hashable RenewalSettings where
hashWithSalt :: Int -> RenewalSettings -> Int
hashWithSalt Int
_salt RenewalSettings' {Maybe Natural
Maybe ReservationAutomaticRenewal
renewalCount :: Maybe Natural
automaticRenewal :: Maybe ReservationAutomaticRenewal
$sel:renewalCount:RenewalSettings' :: RenewalSettings -> Maybe Natural
$sel:automaticRenewal:RenewalSettings' :: RenewalSettings -> Maybe ReservationAutomaticRenewal
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReservationAutomaticRenewal
automaticRenewal
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
renewalCount
instance Prelude.NFData RenewalSettings where
rnf :: RenewalSettings -> ()
rnf RenewalSettings' {Maybe Natural
Maybe ReservationAutomaticRenewal
renewalCount :: Maybe Natural
automaticRenewal :: Maybe ReservationAutomaticRenewal
$sel:renewalCount:RenewalSettings' :: RenewalSettings -> Maybe Natural
$sel:automaticRenewal:RenewalSettings' :: RenewalSettings -> Maybe ReservationAutomaticRenewal
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ReservationAutomaticRenewal
automaticRenewal
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
renewalCount
instance Data.ToJSON RenewalSettings where
toJSON :: RenewalSettings -> Value
toJSON RenewalSettings' {Maybe Natural
Maybe ReservationAutomaticRenewal
renewalCount :: Maybe Natural
automaticRenewal :: Maybe ReservationAutomaticRenewal
$sel:renewalCount:RenewalSettings' :: RenewalSettings -> Maybe Natural
$sel:automaticRenewal:RenewalSettings' :: RenewalSettings -> Maybe ReservationAutomaticRenewal
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"automaticRenewal" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReservationAutomaticRenewal
automaticRenewal,
(Key
"renewalCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
renewalCount
]
)