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