{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DLM.Types.RetentionIntervalUnitValues
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:count:DeprecateRule' :: Maybe Natural
count = forall a. Maybe a
Prelude.Nothing,
$sel:interval:DeprecateRule' :: Maybe Natural
interval = forall a. Maybe a
Prelude.Nothing,
$sel:intervalUnit:DeprecateRule' :: Maybe RetentionIntervalUnitValues
intervalUnit = forall a. Maybe a
Prelude.Nothing
}
deprecateRule_count :: Lens.Lens' DeprecateRule (Prelude.Maybe Prelude.Natural)
deprecateRule_count :: Lens' DeprecateRule (Maybe Natural)
deprecateRule_count = 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 :: Lens' DeprecateRule (Maybe Natural)
deprecateRule_interval = 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 :: Lens' DeprecateRule (Maybe RetentionIntervalUnitValues)
deprecateRule_intervalUnit = 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 Data.FromJSON DeprecateRule where
parseJSON :: Value -> Parser DeprecateRule
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DeprecateRule"
( \Object
x ->
Maybe Natural
-> Maybe Natural
-> Maybe RetentionIntervalUnitValues
-> DeprecateRule
DeprecateRule'
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
"Count")
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
"Interval")
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
"IntervalUnit")
)
instance Prelude.Hashable DeprecateRule where
hashWithSalt :: Int -> DeprecateRule -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
count
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
interval
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RetentionIntervalUnitValues
intervalUnit
instance Prelude.NFData DeprecateRule where
rnf :: DeprecateRule -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
count
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
interval
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RetentionIntervalUnitValues
intervalUnit
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Count" 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
count,
(Key
"Interval" 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
interval,
(Key
"IntervalUnit" 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 RetentionIntervalUnitValues
intervalUnit
]
)