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