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