{-# 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.DynamoDB.DeleteBackup
(
DeleteBackup (..),
newDeleteBackup,
deleteBackup_backupArn,
DeleteBackupResponse (..),
newDeleteBackupResponse,
deleteBackupResponse_backupDescription,
deleteBackupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.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 DeleteBackup = DeleteBackup'
{
DeleteBackup -> Text
backupArn :: Prelude.Text
}
deriving (DeleteBackup -> DeleteBackup -> Bool
(DeleteBackup -> DeleteBackup -> Bool)
-> (DeleteBackup -> DeleteBackup -> Bool) -> Eq DeleteBackup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBackup -> DeleteBackup -> Bool
$c/= :: DeleteBackup -> DeleteBackup -> Bool
== :: DeleteBackup -> DeleteBackup -> Bool
$c== :: DeleteBackup -> DeleteBackup -> Bool
Prelude.Eq, ReadPrec [DeleteBackup]
ReadPrec DeleteBackup
Int -> ReadS DeleteBackup
ReadS [DeleteBackup]
(Int -> ReadS DeleteBackup)
-> ReadS [DeleteBackup]
-> ReadPrec DeleteBackup
-> ReadPrec [DeleteBackup]
-> Read DeleteBackup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBackup]
$creadListPrec :: ReadPrec [DeleteBackup]
readPrec :: ReadPrec DeleteBackup
$creadPrec :: ReadPrec DeleteBackup
readList :: ReadS [DeleteBackup]
$creadList :: ReadS [DeleteBackup]
readsPrec :: Int -> ReadS DeleteBackup
$creadsPrec :: Int -> ReadS DeleteBackup
Prelude.Read, Int -> DeleteBackup -> ShowS
[DeleteBackup] -> ShowS
DeleteBackup -> String
(Int -> DeleteBackup -> ShowS)
-> (DeleteBackup -> String)
-> ([DeleteBackup] -> ShowS)
-> Show DeleteBackup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBackup] -> ShowS
$cshowList :: [DeleteBackup] -> ShowS
show :: DeleteBackup -> String
$cshow :: DeleteBackup -> String
showsPrec :: Int -> DeleteBackup -> ShowS
$cshowsPrec :: Int -> DeleteBackup -> ShowS
Prelude.Show, (forall x. DeleteBackup -> Rep DeleteBackup x)
-> (forall x. Rep DeleteBackup x -> DeleteBackup)
-> Generic DeleteBackup
forall x. Rep DeleteBackup x -> DeleteBackup
forall x. DeleteBackup -> Rep DeleteBackup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBackup x -> DeleteBackup
$cfrom :: forall x. DeleteBackup -> Rep DeleteBackup x
Prelude.Generic)
newDeleteBackup ::
Prelude.Text ->
DeleteBackup
newDeleteBackup :: Text -> DeleteBackup
newDeleteBackup Text
pBackupArn_ =
DeleteBackup' :: Text -> DeleteBackup
DeleteBackup' {$sel:backupArn:DeleteBackup' :: Text
backupArn = Text
pBackupArn_}
deleteBackup_backupArn :: Lens.Lens' DeleteBackup Prelude.Text
deleteBackup_backupArn :: (Text -> f Text) -> DeleteBackup -> f DeleteBackup
deleteBackup_backupArn = (DeleteBackup -> Text)
-> (DeleteBackup -> Text -> DeleteBackup)
-> Lens DeleteBackup DeleteBackup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBackup' {Text
backupArn :: Text
$sel:backupArn:DeleteBackup' :: DeleteBackup -> Text
backupArn} -> Text
backupArn) (\s :: DeleteBackup
s@DeleteBackup' {} Text
a -> DeleteBackup
s {$sel:backupArn:DeleteBackup' :: Text
backupArn = Text
a} :: DeleteBackup)
instance Core.AWSRequest DeleteBackup where
type AWSResponse DeleteBackup = DeleteBackupResponse
request :: DeleteBackup -> Request DeleteBackup
request = Service -> DeleteBackup -> Request DeleteBackup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteBackup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBackup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteBackup))
-> Logger
-> Service
-> Proxy DeleteBackup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBackup)))
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 ->
Maybe BackupDescription -> Int -> DeleteBackupResponse
DeleteBackupResponse'
(Maybe BackupDescription -> Int -> DeleteBackupResponse)
-> Either String (Maybe BackupDescription)
-> Either String (Int -> DeleteBackupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe BackupDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BackupDescription")
Either String (Int -> DeleteBackupResponse)
-> Either String Int -> Either String DeleteBackupResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DeleteBackup
instance Prelude.NFData DeleteBackup
instance Core.ToHeaders DeleteBackup where
toHeaders :: DeleteBackup -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteBackup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DynamoDB_20120810.DeleteBackup" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DeleteBackup where
toJSON :: DeleteBackup -> Value
toJSON DeleteBackup' {Text
backupArn :: Text
$sel:backupArn:DeleteBackup' :: DeleteBackup -> 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
"BackupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
backupArn)]
)
instance Core.ToPath DeleteBackup where
toPath :: DeleteBackup -> ByteString
toPath = ByteString -> DeleteBackup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteBackup where
toQuery :: DeleteBackup -> QueryString
toQuery = QueryString -> DeleteBackup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteBackupResponse = DeleteBackupResponse'
{
DeleteBackupResponse -> Maybe BackupDescription
backupDescription :: Prelude.Maybe BackupDescription,
DeleteBackupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteBackupResponse -> DeleteBackupResponse -> Bool
(DeleteBackupResponse -> DeleteBackupResponse -> Bool)
-> (DeleteBackupResponse -> DeleteBackupResponse -> Bool)
-> Eq DeleteBackupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBackupResponse -> DeleteBackupResponse -> Bool
$c/= :: DeleteBackupResponse -> DeleteBackupResponse -> Bool
== :: DeleteBackupResponse -> DeleteBackupResponse -> Bool
$c== :: DeleteBackupResponse -> DeleteBackupResponse -> Bool
Prelude.Eq, ReadPrec [DeleteBackupResponse]
ReadPrec DeleteBackupResponse
Int -> ReadS DeleteBackupResponse
ReadS [DeleteBackupResponse]
(Int -> ReadS DeleteBackupResponse)
-> ReadS [DeleteBackupResponse]
-> ReadPrec DeleteBackupResponse
-> ReadPrec [DeleteBackupResponse]
-> Read DeleteBackupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBackupResponse]
$creadListPrec :: ReadPrec [DeleteBackupResponse]
readPrec :: ReadPrec DeleteBackupResponse
$creadPrec :: ReadPrec DeleteBackupResponse
readList :: ReadS [DeleteBackupResponse]
$creadList :: ReadS [DeleteBackupResponse]
readsPrec :: Int -> ReadS DeleteBackupResponse
$creadsPrec :: Int -> ReadS DeleteBackupResponse
Prelude.Read, Int -> DeleteBackupResponse -> ShowS
[DeleteBackupResponse] -> ShowS
DeleteBackupResponse -> String
(Int -> DeleteBackupResponse -> ShowS)
-> (DeleteBackupResponse -> String)
-> ([DeleteBackupResponse] -> ShowS)
-> Show DeleteBackupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBackupResponse] -> ShowS
$cshowList :: [DeleteBackupResponse] -> ShowS
show :: DeleteBackupResponse -> String
$cshow :: DeleteBackupResponse -> String
showsPrec :: Int -> DeleteBackupResponse -> ShowS
$cshowsPrec :: Int -> DeleteBackupResponse -> ShowS
Prelude.Show, (forall x. DeleteBackupResponse -> Rep DeleteBackupResponse x)
-> (forall x. Rep DeleteBackupResponse x -> DeleteBackupResponse)
-> Generic DeleteBackupResponse
forall x. Rep DeleteBackupResponse x -> DeleteBackupResponse
forall x. DeleteBackupResponse -> Rep DeleteBackupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBackupResponse x -> DeleteBackupResponse
$cfrom :: forall x. DeleteBackupResponse -> Rep DeleteBackupResponse x
Prelude.Generic)
newDeleteBackupResponse ::
Prelude.Int ->
DeleteBackupResponse
newDeleteBackupResponse :: Int -> DeleteBackupResponse
newDeleteBackupResponse Int
pHttpStatus_ =
DeleteBackupResponse' :: Maybe BackupDescription -> Int -> DeleteBackupResponse
DeleteBackupResponse'
{ $sel:backupDescription:DeleteBackupResponse' :: Maybe BackupDescription
backupDescription =
Maybe BackupDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteBackupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteBackupResponse_backupDescription :: Lens.Lens' DeleteBackupResponse (Prelude.Maybe BackupDescription)
deleteBackupResponse_backupDescription :: (Maybe BackupDescription -> f (Maybe BackupDescription))
-> DeleteBackupResponse -> f DeleteBackupResponse
deleteBackupResponse_backupDescription = (DeleteBackupResponse -> Maybe BackupDescription)
-> (DeleteBackupResponse
-> Maybe BackupDescription -> DeleteBackupResponse)
-> Lens
DeleteBackupResponse
DeleteBackupResponse
(Maybe BackupDescription)
(Maybe BackupDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBackupResponse' {Maybe BackupDescription
backupDescription :: Maybe BackupDescription
$sel:backupDescription:DeleteBackupResponse' :: DeleteBackupResponse -> Maybe BackupDescription
backupDescription} -> Maybe BackupDescription
backupDescription) (\s :: DeleteBackupResponse
s@DeleteBackupResponse' {} Maybe BackupDescription
a -> DeleteBackupResponse
s {$sel:backupDescription:DeleteBackupResponse' :: Maybe BackupDescription
backupDescription = Maybe BackupDescription
a} :: DeleteBackupResponse)
deleteBackupResponse_httpStatus :: Lens.Lens' DeleteBackupResponse Prelude.Int
deleteBackupResponse_httpStatus :: (Int -> f Int) -> DeleteBackupResponse -> f DeleteBackupResponse
deleteBackupResponse_httpStatus = (DeleteBackupResponse -> Int)
-> (DeleteBackupResponse -> Int -> DeleteBackupResponse)
-> Lens DeleteBackupResponse DeleteBackupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBackupResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteBackupResponse' :: DeleteBackupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteBackupResponse
s@DeleteBackupResponse' {} Int
a -> DeleteBackupResponse
s {$sel:httpStatus:DeleteBackupResponse' :: Int
httpStatus = Int
a} :: DeleteBackupResponse)
instance Prelude.NFData DeleteBackupResponse