{-# 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.OpsWorksCM.DeleteBackup
(
DeleteBackup (..),
newDeleteBackup,
deleteBackup_backupId,
DeleteBackupResponse (..),
newDeleteBackupResponse,
deleteBackupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorksCM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteBackup = DeleteBackup'
{
DeleteBackup -> Text
backupId :: 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
pBackupId_ =
DeleteBackup' :: Text -> DeleteBackup
DeleteBackup' {$sel:backupId:DeleteBackup' :: Text
backupId = Text
pBackupId_}
deleteBackup_backupId :: Lens.Lens' DeleteBackup Prelude.Text
deleteBackup_backupId :: (Text -> f Text) -> DeleteBackup -> f DeleteBackup
deleteBackup_backupId = (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
backupId :: Text
$sel:backupId:DeleteBackup' :: DeleteBackup -> Text
backupId} -> Text
backupId) (\s :: DeleteBackup
s@DeleteBackup' {} Text
a -> DeleteBackup
s {$sel:backupId:DeleteBackup' :: Text
backupId = 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
-> ()
-> Either String (AWSResponse DeleteBackup))
-> Logger
-> Service
-> Proxy DeleteBackup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBackup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> DeleteBackupResponse
DeleteBackupResponse'
(Int -> DeleteBackupResponse)
-> Either String Int -> Either String DeleteBackupResponse
forall (f :: * -> *) a b. Functor 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
"OpsWorksCM_V2016_11_01.DeleteBackup" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DeleteBackup where
toJSON :: DeleteBackup -> Value
toJSON DeleteBackup' {Text
backupId :: Text
$sel:backupId: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
"BackupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
backupId)]
)
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 -> 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' :: Int -> DeleteBackupResponse
DeleteBackupResponse' {$sel:httpStatus:DeleteBackupResponse' :: Int
httpStatus = Int
pHttpStatus_}
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