{-# 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.CrossRegionCopyRetainRule 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 CrossRegionCopyRetainRule = CrossRegionCopyRetainRule'
{
CrossRegionCopyRetainRule -> Maybe Natural
interval :: Prelude.Maybe Prelude.Natural,
CrossRegionCopyRetainRule -> Maybe RetentionIntervalUnitValues
intervalUnit :: Prelude.Maybe RetentionIntervalUnitValues
}
deriving (CrossRegionCopyRetainRule -> CrossRegionCopyRetainRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CrossRegionCopyRetainRule -> CrossRegionCopyRetainRule -> Bool
$c/= :: CrossRegionCopyRetainRule -> CrossRegionCopyRetainRule -> Bool
== :: CrossRegionCopyRetainRule -> CrossRegionCopyRetainRule -> Bool
$c== :: CrossRegionCopyRetainRule -> CrossRegionCopyRetainRule -> Bool
Prelude.Eq, ReadPrec [CrossRegionCopyRetainRule]
ReadPrec CrossRegionCopyRetainRule
Int -> ReadS CrossRegionCopyRetainRule
ReadS [CrossRegionCopyRetainRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CrossRegionCopyRetainRule]
$creadListPrec :: ReadPrec [CrossRegionCopyRetainRule]
readPrec :: ReadPrec CrossRegionCopyRetainRule
$creadPrec :: ReadPrec CrossRegionCopyRetainRule
readList :: ReadS [CrossRegionCopyRetainRule]
$creadList :: ReadS [CrossRegionCopyRetainRule]
readsPrec :: Int -> ReadS CrossRegionCopyRetainRule
$creadsPrec :: Int -> ReadS CrossRegionCopyRetainRule
Prelude.Read, Int -> CrossRegionCopyRetainRule -> ShowS
[CrossRegionCopyRetainRule] -> ShowS
CrossRegionCopyRetainRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CrossRegionCopyRetainRule] -> ShowS
$cshowList :: [CrossRegionCopyRetainRule] -> ShowS
show :: CrossRegionCopyRetainRule -> String
$cshow :: CrossRegionCopyRetainRule -> String
showsPrec :: Int -> CrossRegionCopyRetainRule -> ShowS
$cshowsPrec :: Int -> CrossRegionCopyRetainRule -> ShowS
Prelude.Show, forall x.
Rep CrossRegionCopyRetainRule x -> CrossRegionCopyRetainRule
forall x.
CrossRegionCopyRetainRule -> Rep CrossRegionCopyRetainRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CrossRegionCopyRetainRule x -> CrossRegionCopyRetainRule
$cfrom :: forall x.
CrossRegionCopyRetainRule -> Rep CrossRegionCopyRetainRule x
Prelude.Generic)
newCrossRegionCopyRetainRule ::
CrossRegionCopyRetainRule
newCrossRegionCopyRetainRule :: CrossRegionCopyRetainRule
newCrossRegionCopyRetainRule =
CrossRegionCopyRetainRule'
{ $sel:interval:CrossRegionCopyRetainRule' :: Maybe Natural
interval =
forall a. Maybe a
Prelude.Nothing,
$sel:intervalUnit:CrossRegionCopyRetainRule' :: Maybe RetentionIntervalUnitValues
intervalUnit = forall a. Maybe a
Prelude.Nothing
}
crossRegionCopyRetainRule_interval :: Lens.Lens' CrossRegionCopyRetainRule (Prelude.Maybe Prelude.Natural)
crossRegionCopyRetainRule_interval :: Lens' CrossRegionCopyRetainRule (Maybe Natural)
crossRegionCopyRetainRule_interval = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossRegionCopyRetainRule' {Maybe Natural
interval :: Maybe Natural
$sel:interval:CrossRegionCopyRetainRule' :: CrossRegionCopyRetainRule -> Maybe Natural
interval} -> Maybe Natural
interval) (\s :: CrossRegionCopyRetainRule
s@CrossRegionCopyRetainRule' {} Maybe Natural
a -> CrossRegionCopyRetainRule
s {$sel:interval:CrossRegionCopyRetainRule' :: Maybe Natural
interval = Maybe Natural
a} :: CrossRegionCopyRetainRule)
crossRegionCopyRetainRule_intervalUnit :: Lens.Lens' CrossRegionCopyRetainRule (Prelude.Maybe RetentionIntervalUnitValues)
crossRegionCopyRetainRule_intervalUnit :: Lens' CrossRegionCopyRetainRule (Maybe RetentionIntervalUnitValues)
crossRegionCopyRetainRule_intervalUnit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossRegionCopyRetainRule' {Maybe RetentionIntervalUnitValues
intervalUnit :: Maybe RetentionIntervalUnitValues
$sel:intervalUnit:CrossRegionCopyRetainRule' :: CrossRegionCopyRetainRule -> Maybe RetentionIntervalUnitValues
intervalUnit} -> Maybe RetentionIntervalUnitValues
intervalUnit) (\s :: CrossRegionCopyRetainRule
s@CrossRegionCopyRetainRule' {} Maybe RetentionIntervalUnitValues
a -> CrossRegionCopyRetainRule
s {$sel:intervalUnit:CrossRegionCopyRetainRule' :: Maybe RetentionIntervalUnitValues
intervalUnit = Maybe RetentionIntervalUnitValues
a} :: CrossRegionCopyRetainRule)
instance Data.FromJSON CrossRegionCopyRetainRule where
parseJSON :: Value -> Parser CrossRegionCopyRetainRule
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CrossRegionCopyRetainRule"
( \Object
x ->
Maybe Natural
-> Maybe RetentionIntervalUnitValues -> CrossRegionCopyRetainRule
CrossRegionCopyRetainRule'
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
"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 CrossRegionCopyRetainRule where
hashWithSalt :: Int -> CrossRegionCopyRetainRule -> Int
hashWithSalt Int
_salt CrossRegionCopyRetainRule' {Maybe Natural
Maybe RetentionIntervalUnitValues
intervalUnit :: Maybe RetentionIntervalUnitValues
interval :: Maybe Natural
$sel:intervalUnit:CrossRegionCopyRetainRule' :: CrossRegionCopyRetainRule -> Maybe RetentionIntervalUnitValues
$sel:interval:CrossRegionCopyRetainRule' :: CrossRegionCopyRetainRule -> Maybe Natural
..} =
Int
_salt
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 CrossRegionCopyRetainRule where
rnf :: CrossRegionCopyRetainRule -> ()
rnf CrossRegionCopyRetainRule' {Maybe Natural
Maybe RetentionIntervalUnitValues
intervalUnit :: Maybe RetentionIntervalUnitValues
interval :: Maybe Natural
$sel:intervalUnit:CrossRegionCopyRetainRule' :: CrossRegionCopyRetainRule -> Maybe RetentionIntervalUnitValues
$sel:interval:CrossRegionCopyRetainRule' :: CrossRegionCopyRetainRule -> Maybe Natural
..} =
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 CrossRegionCopyRetainRule where
toJSON :: CrossRegionCopyRetainRule -> Value
toJSON CrossRegionCopyRetainRule' {Maybe Natural
Maybe RetentionIntervalUnitValues
intervalUnit :: Maybe RetentionIntervalUnitValues
interval :: Maybe Natural
$sel:intervalUnit:CrossRegionCopyRetainRule' :: CrossRegionCopyRetainRule -> Maybe RetentionIntervalUnitValues
$sel:interval:CrossRegionCopyRetainRule' :: CrossRegionCopyRetainRule -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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
]
)