{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.EFS.PutBackupPolicy
(
PutBackupPolicy (..),
newPutBackupPolicy,
putBackupPolicy_fileSystemId,
putBackupPolicy_backupPolicy,
BackupPolicyDescription (..),
newBackupPolicyDescription,
backupPolicyDescription_backupPolicy,
)
where
import qualified Amazonka.Core as Core
import Amazonka.EFS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutBackupPolicy = PutBackupPolicy'
{
PutBackupPolicy -> Text
fileSystemId :: Prelude.Text,
PutBackupPolicy -> BackupPolicy
backupPolicy :: BackupPolicy
}
deriving (PutBackupPolicy -> PutBackupPolicy -> Bool
(PutBackupPolicy -> PutBackupPolicy -> Bool)
-> (PutBackupPolicy -> PutBackupPolicy -> Bool)
-> Eq PutBackupPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutBackupPolicy -> PutBackupPolicy -> Bool
$c/= :: PutBackupPolicy -> PutBackupPolicy -> Bool
== :: PutBackupPolicy -> PutBackupPolicy -> Bool
$c== :: PutBackupPolicy -> PutBackupPolicy -> Bool
Prelude.Eq, ReadPrec [PutBackupPolicy]
ReadPrec PutBackupPolicy
Int -> ReadS PutBackupPolicy
ReadS [PutBackupPolicy]
(Int -> ReadS PutBackupPolicy)
-> ReadS [PutBackupPolicy]
-> ReadPrec PutBackupPolicy
-> ReadPrec [PutBackupPolicy]
-> Read PutBackupPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutBackupPolicy]
$creadListPrec :: ReadPrec [PutBackupPolicy]
readPrec :: ReadPrec PutBackupPolicy
$creadPrec :: ReadPrec PutBackupPolicy
readList :: ReadS [PutBackupPolicy]
$creadList :: ReadS [PutBackupPolicy]
readsPrec :: Int -> ReadS PutBackupPolicy
$creadsPrec :: Int -> ReadS PutBackupPolicy
Prelude.Read, Int -> PutBackupPolicy -> ShowS
[PutBackupPolicy] -> ShowS
PutBackupPolicy -> String
(Int -> PutBackupPolicy -> ShowS)
-> (PutBackupPolicy -> String)
-> ([PutBackupPolicy] -> ShowS)
-> Show PutBackupPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutBackupPolicy] -> ShowS
$cshowList :: [PutBackupPolicy] -> ShowS
show :: PutBackupPolicy -> String
$cshow :: PutBackupPolicy -> String
showsPrec :: Int -> PutBackupPolicy -> ShowS
$cshowsPrec :: Int -> PutBackupPolicy -> ShowS
Prelude.Show, (forall x. PutBackupPolicy -> Rep PutBackupPolicy x)
-> (forall x. Rep PutBackupPolicy x -> PutBackupPolicy)
-> Generic PutBackupPolicy
forall x. Rep PutBackupPolicy x -> PutBackupPolicy
forall x. PutBackupPolicy -> Rep PutBackupPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutBackupPolicy x -> PutBackupPolicy
$cfrom :: forall x. PutBackupPolicy -> Rep PutBackupPolicy x
Prelude.Generic)
newPutBackupPolicy ::
Prelude.Text ->
BackupPolicy ->
PutBackupPolicy
newPutBackupPolicy :: Text -> BackupPolicy -> PutBackupPolicy
newPutBackupPolicy Text
pFileSystemId_ BackupPolicy
pBackupPolicy_ =
PutBackupPolicy' :: Text -> BackupPolicy -> PutBackupPolicy
PutBackupPolicy'
{ $sel:fileSystemId:PutBackupPolicy' :: Text
fileSystemId = Text
pFileSystemId_,
$sel:backupPolicy:PutBackupPolicy' :: BackupPolicy
backupPolicy = BackupPolicy
pBackupPolicy_
}
putBackupPolicy_fileSystemId :: Lens.Lens' PutBackupPolicy Prelude.Text
putBackupPolicy_fileSystemId :: (Text -> f Text) -> PutBackupPolicy -> f PutBackupPolicy
putBackupPolicy_fileSystemId = (PutBackupPolicy -> Text)
-> (PutBackupPolicy -> Text -> PutBackupPolicy)
-> Lens PutBackupPolicy PutBackupPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBackupPolicy' {Text
fileSystemId :: Text
$sel:fileSystemId:PutBackupPolicy' :: PutBackupPolicy -> Text
fileSystemId} -> Text
fileSystemId) (\s :: PutBackupPolicy
s@PutBackupPolicy' {} Text
a -> PutBackupPolicy
s {$sel:fileSystemId:PutBackupPolicy' :: Text
fileSystemId = Text
a} :: PutBackupPolicy)
putBackupPolicy_backupPolicy :: Lens.Lens' PutBackupPolicy BackupPolicy
putBackupPolicy_backupPolicy :: (BackupPolicy -> f BackupPolicy)
-> PutBackupPolicy -> f PutBackupPolicy
putBackupPolicy_backupPolicy = (PutBackupPolicy -> BackupPolicy)
-> (PutBackupPolicy -> BackupPolicy -> PutBackupPolicy)
-> Lens PutBackupPolicy PutBackupPolicy BackupPolicy BackupPolicy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBackupPolicy' {BackupPolicy
backupPolicy :: BackupPolicy
$sel:backupPolicy:PutBackupPolicy' :: PutBackupPolicy -> BackupPolicy
backupPolicy} -> BackupPolicy
backupPolicy) (\s :: PutBackupPolicy
s@PutBackupPolicy' {} BackupPolicy
a -> PutBackupPolicy
s {$sel:backupPolicy:PutBackupPolicy' :: BackupPolicy
backupPolicy = BackupPolicy
a} :: PutBackupPolicy)
instance Core.AWSRequest PutBackupPolicy where
type
AWSResponse PutBackupPolicy =
BackupPolicyDescription
request :: PutBackupPolicy -> Request PutBackupPolicy
request = Service -> PutBackupPolicy -> Request PutBackupPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutBackupPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutBackupPolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutBackupPolicy))
-> Logger
-> Service
-> Proxy PutBackupPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutBackupPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> Object -> Either String BackupPolicyDescription
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable PutBackupPolicy
instance Prelude.NFData PutBackupPolicy
instance Core.ToHeaders PutBackupPolicy where
toHeaders :: PutBackupPolicy -> ResponseHeaders
toHeaders = ResponseHeaders -> PutBackupPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON PutBackupPolicy where
toJSON :: PutBackupPolicy -> Value
toJSON PutBackupPolicy' {Text
BackupPolicy
backupPolicy :: BackupPolicy
fileSystemId :: Text
$sel:backupPolicy:PutBackupPolicy' :: PutBackupPolicy -> BackupPolicy
$sel:fileSystemId:PutBackupPolicy' :: PutBackupPolicy -> Text
..} =
[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
"BackupPolicy" Text -> BackupPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BackupPolicy
backupPolicy)]
)
instance Core.ToPath PutBackupPolicy where
toPath :: PutBackupPolicy -> ByteString
toPath PutBackupPolicy' {Text
BackupPolicy
backupPolicy :: BackupPolicy
fileSystemId :: Text
$sel:backupPolicy:PutBackupPolicy' :: PutBackupPolicy -> BackupPolicy
$sel:fileSystemId:PutBackupPolicy' :: PutBackupPolicy -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2015-02-01/file-systems/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
fileSystemId,
ByteString
"/backup-policy"
]
instance Core.ToQuery PutBackupPolicy where
toQuery :: PutBackupPolicy -> QueryString
toQuery = QueryString -> PutBackupPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty