{-# 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.RDS.DeleteDBInstance
(
DeleteDBInstance (..),
newDeleteDBInstance,
deleteDBInstance_finalDBSnapshotIdentifier,
deleteDBInstance_deleteAutomatedBackups,
deleteDBInstance_skipFinalSnapshot,
deleteDBInstance_dbInstanceIdentifier,
DeleteDBInstanceResponse (..),
newDeleteDBInstanceResponse,
deleteDBInstanceResponse_dbInstance,
deleteDBInstanceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteDBInstance = DeleteDBInstance'
{
DeleteDBInstance -> Maybe Text
finalDBSnapshotIdentifier :: Prelude.Maybe Prelude.Text,
DeleteDBInstance -> Maybe Bool
deleteAutomatedBackups :: Prelude.Maybe Prelude.Bool,
DeleteDBInstance -> Maybe Bool
skipFinalSnapshot :: Prelude.Maybe Prelude.Bool,
DeleteDBInstance -> Text
dbInstanceIdentifier :: Prelude.Text
}
deriving (DeleteDBInstance -> DeleteDBInstance -> Bool
(DeleteDBInstance -> DeleteDBInstance -> Bool)
-> (DeleteDBInstance -> DeleteDBInstance -> Bool)
-> Eq DeleteDBInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDBInstance -> DeleteDBInstance -> Bool
$c/= :: DeleteDBInstance -> DeleteDBInstance -> Bool
== :: DeleteDBInstance -> DeleteDBInstance -> Bool
$c== :: DeleteDBInstance -> DeleteDBInstance -> Bool
Prelude.Eq, ReadPrec [DeleteDBInstance]
ReadPrec DeleteDBInstance
Int -> ReadS DeleteDBInstance
ReadS [DeleteDBInstance]
(Int -> ReadS DeleteDBInstance)
-> ReadS [DeleteDBInstance]
-> ReadPrec DeleteDBInstance
-> ReadPrec [DeleteDBInstance]
-> Read DeleteDBInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDBInstance]
$creadListPrec :: ReadPrec [DeleteDBInstance]
readPrec :: ReadPrec DeleteDBInstance
$creadPrec :: ReadPrec DeleteDBInstance
readList :: ReadS [DeleteDBInstance]
$creadList :: ReadS [DeleteDBInstance]
readsPrec :: Int -> ReadS DeleteDBInstance
$creadsPrec :: Int -> ReadS DeleteDBInstance
Prelude.Read, Int -> DeleteDBInstance -> ShowS
[DeleteDBInstance] -> ShowS
DeleteDBInstance -> String
(Int -> DeleteDBInstance -> ShowS)
-> (DeleteDBInstance -> String)
-> ([DeleteDBInstance] -> ShowS)
-> Show DeleteDBInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDBInstance] -> ShowS
$cshowList :: [DeleteDBInstance] -> ShowS
show :: DeleteDBInstance -> String
$cshow :: DeleteDBInstance -> String
showsPrec :: Int -> DeleteDBInstance -> ShowS
$cshowsPrec :: Int -> DeleteDBInstance -> ShowS
Prelude.Show, (forall x. DeleteDBInstance -> Rep DeleteDBInstance x)
-> (forall x. Rep DeleteDBInstance x -> DeleteDBInstance)
-> Generic DeleteDBInstance
forall x. Rep DeleteDBInstance x -> DeleteDBInstance
forall x. DeleteDBInstance -> Rep DeleteDBInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDBInstance x -> DeleteDBInstance
$cfrom :: forall x. DeleteDBInstance -> Rep DeleteDBInstance x
Prelude.Generic)
newDeleteDBInstance ::
Prelude.Text ->
DeleteDBInstance
newDeleteDBInstance :: Text -> DeleteDBInstance
newDeleteDBInstance Text
pDBInstanceIdentifier_ =
DeleteDBInstance' :: Maybe Text -> Maybe Bool -> Maybe Bool -> Text -> DeleteDBInstance
DeleteDBInstance'
{ $sel:finalDBSnapshotIdentifier:DeleteDBInstance' :: Maybe Text
finalDBSnapshotIdentifier =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:deleteAutomatedBackups:DeleteDBInstance' :: Maybe Bool
deleteAutomatedBackups = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:skipFinalSnapshot:DeleteDBInstance' :: Maybe Bool
skipFinalSnapshot = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:dbInstanceIdentifier:DeleteDBInstance' :: Text
dbInstanceIdentifier = Text
pDBInstanceIdentifier_
}
deleteDBInstance_finalDBSnapshotIdentifier :: Lens.Lens' DeleteDBInstance (Prelude.Maybe Prelude.Text)
deleteDBInstance_finalDBSnapshotIdentifier :: (Maybe Text -> f (Maybe Text))
-> DeleteDBInstance -> f DeleteDBInstance
deleteDBInstance_finalDBSnapshotIdentifier = (DeleteDBInstance -> Maybe Text)
-> (DeleteDBInstance -> Maybe Text -> DeleteDBInstance)
-> Lens DeleteDBInstance DeleteDBInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBInstance' {Maybe Text
finalDBSnapshotIdentifier :: Maybe Text
$sel:finalDBSnapshotIdentifier:DeleteDBInstance' :: DeleteDBInstance -> Maybe Text
finalDBSnapshotIdentifier} -> Maybe Text
finalDBSnapshotIdentifier) (\s :: DeleteDBInstance
s@DeleteDBInstance' {} Maybe Text
a -> DeleteDBInstance
s {$sel:finalDBSnapshotIdentifier:DeleteDBInstance' :: Maybe Text
finalDBSnapshotIdentifier = Maybe Text
a} :: DeleteDBInstance)
deleteDBInstance_deleteAutomatedBackups :: Lens.Lens' DeleteDBInstance (Prelude.Maybe Prelude.Bool)
deleteDBInstance_deleteAutomatedBackups :: (Maybe Bool -> f (Maybe Bool))
-> DeleteDBInstance -> f DeleteDBInstance
deleteDBInstance_deleteAutomatedBackups = (DeleteDBInstance -> Maybe Bool)
-> (DeleteDBInstance -> Maybe Bool -> DeleteDBInstance)
-> Lens DeleteDBInstance DeleteDBInstance (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBInstance' {Maybe Bool
deleteAutomatedBackups :: Maybe Bool
$sel:deleteAutomatedBackups:DeleteDBInstance' :: DeleteDBInstance -> Maybe Bool
deleteAutomatedBackups} -> Maybe Bool
deleteAutomatedBackups) (\s :: DeleteDBInstance
s@DeleteDBInstance' {} Maybe Bool
a -> DeleteDBInstance
s {$sel:deleteAutomatedBackups:DeleteDBInstance' :: Maybe Bool
deleteAutomatedBackups = Maybe Bool
a} :: DeleteDBInstance)
deleteDBInstance_skipFinalSnapshot :: Lens.Lens' DeleteDBInstance (Prelude.Maybe Prelude.Bool)
deleteDBInstance_skipFinalSnapshot :: (Maybe Bool -> f (Maybe Bool))
-> DeleteDBInstance -> f DeleteDBInstance
deleteDBInstance_skipFinalSnapshot = (DeleteDBInstance -> Maybe Bool)
-> (DeleteDBInstance -> Maybe Bool -> DeleteDBInstance)
-> Lens DeleteDBInstance DeleteDBInstance (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBInstance' {Maybe Bool
skipFinalSnapshot :: Maybe Bool
$sel:skipFinalSnapshot:DeleteDBInstance' :: DeleteDBInstance -> Maybe Bool
skipFinalSnapshot} -> Maybe Bool
skipFinalSnapshot) (\s :: DeleteDBInstance
s@DeleteDBInstance' {} Maybe Bool
a -> DeleteDBInstance
s {$sel:skipFinalSnapshot:DeleteDBInstance' :: Maybe Bool
skipFinalSnapshot = Maybe Bool
a} :: DeleteDBInstance)
deleteDBInstance_dbInstanceIdentifier :: Lens.Lens' DeleteDBInstance Prelude.Text
deleteDBInstance_dbInstanceIdentifier :: (Text -> f Text) -> DeleteDBInstance -> f DeleteDBInstance
deleteDBInstance_dbInstanceIdentifier = (DeleteDBInstance -> Text)
-> (DeleteDBInstance -> Text -> DeleteDBInstance)
-> Lens DeleteDBInstance DeleteDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBInstance' {Text
dbInstanceIdentifier :: Text
$sel:dbInstanceIdentifier:DeleteDBInstance' :: DeleteDBInstance -> Text
dbInstanceIdentifier} -> Text
dbInstanceIdentifier) (\s :: DeleteDBInstance
s@DeleteDBInstance' {} Text
a -> DeleteDBInstance
s {$sel:dbInstanceIdentifier:DeleteDBInstance' :: Text
dbInstanceIdentifier = Text
a} :: DeleteDBInstance)
instance Core.AWSRequest DeleteDBInstance where
type
AWSResponse DeleteDBInstance =
DeleteDBInstanceResponse
request :: DeleteDBInstance -> Request DeleteDBInstance
request = Service -> DeleteDBInstance -> Request DeleteDBInstance
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteDBInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDBInstance)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DeleteDBInstance))
-> Logger
-> Service
-> Proxy DeleteDBInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDBInstance)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"DeleteDBInstanceResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe DBInstance -> Int -> DeleteDBInstanceResponse
DeleteDBInstanceResponse'
(Maybe DBInstance -> Int -> DeleteDBInstanceResponse)
-> Either String (Maybe DBInstance)
-> Either String (Int -> DeleteDBInstanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBInstance)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBInstance")
Either String (Int -> DeleteDBInstanceResponse)
-> Either String Int -> Either String DeleteDBInstanceResponse
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 DeleteDBInstance
instance Prelude.NFData DeleteDBInstance
instance Core.ToHeaders DeleteDBInstance where
toHeaders :: DeleteDBInstance -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteDBInstance -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DeleteDBInstance where
toPath :: DeleteDBInstance -> ByteString
toPath = ByteString -> DeleteDBInstance -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteDBInstance where
toQuery :: DeleteDBInstance -> QueryString
toQuery DeleteDBInstance' {Maybe Bool
Maybe Text
Text
dbInstanceIdentifier :: Text
skipFinalSnapshot :: Maybe Bool
deleteAutomatedBackups :: Maybe Bool
finalDBSnapshotIdentifier :: Maybe Text
$sel:dbInstanceIdentifier:DeleteDBInstance' :: DeleteDBInstance -> Text
$sel:skipFinalSnapshot:DeleteDBInstance' :: DeleteDBInstance -> Maybe Bool
$sel:deleteAutomatedBackups:DeleteDBInstance' :: DeleteDBInstance -> Maybe Bool
$sel:finalDBSnapshotIdentifier:DeleteDBInstance' :: DeleteDBInstance -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteDBInstance" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
ByteString
"FinalDBSnapshotIdentifier"
ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
finalDBSnapshotIdentifier,
ByteString
"DeleteAutomatedBackups"
ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
deleteAutomatedBackups,
ByteString
"SkipFinalSnapshot" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
skipFinalSnapshot,
ByteString
"DBInstanceIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceIdentifier
]
data DeleteDBInstanceResponse = DeleteDBInstanceResponse'
{ DeleteDBInstanceResponse -> Maybe DBInstance
dbInstance :: Prelude.Maybe DBInstance,
DeleteDBInstanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteDBInstanceResponse -> DeleteDBInstanceResponse -> Bool
(DeleteDBInstanceResponse -> DeleteDBInstanceResponse -> Bool)
-> (DeleteDBInstanceResponse -> DeleteDBInstanceResponse -> Bool)
-> Eq DeleteDBInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDBInstanceResponse -> DeleteDBInstanceResponse -> Bool
$c/= :: DeleteDBInstanceResponse -> DeleteDBInstanceResponse -> Bool
== :: DeleteDBInstanceResponse -> DeleteDBInstanceResponse -> Bool
$c== :: DeleteDBInstanceResponse -> DeleteDBInstanceResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDBInstanceResponse]
ReadPrec DeleteDBInstanceResponse
Int -> ReadS DeleteDBInstanceResponse
ReadS [DeleteDBInstanceResponse]
(Int -> ReadS DeleteDBInstanceResponse)
-> ReadS [DeleteDBInstanceResponse]
-> ReadPrec DeleteDBInstanceResponse
-> ReadPrec [DeleteDBInstanceResponse]
-> Read DeleteDBInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDBInstanceResponse]
$creadListPrec :: ReadPrec [DeleteDBInstanceResponse]
readPrec :: ReadPrec DeleteDBInstanceResponse
$creadPrec :: ReadPrec DeleteDBInstanceResponse
readList :: ReadS [DeleteDBInstanceResponse]
$creadList :: ReadS [DeleteDBInstanceResponse]
readsPrec :: Int -> ReadS DeleteDBInstanceResponse
$creadsPrec :: Int -> ReadS DeleteDBInstanceResponse
Prelude.Read, Int -> DeleteDBInstanceResponse -> ShowS
[DeleteDBInstanceResponse] -> ShowS
DeleteDBInstanceResponse -> String
(Int -> DeleteDBInstanceResponse -> ShowS)
-> (DeleteDBInstanceResponse -> String)
-> ([DeleteDBInstanceResponse] -> ShowS)
-> Show DeleteDBInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDBInstanceResponse] -> ShowS
$cshowList :: [DeleteDBInstanceResponse] -> ShowS
show :: DeleteDBInstanceResponse -> String
$cshow :: DeleteDBInstanceResponse -> String
showsPrec :: Int -> DeleteDBInstanceResponse -> ShowS
$cshowsPrec :: Int -> DeleteDBInstanceResponse -> ShowS
Prelude.Show, (forall x.
DeleteDBInstanceResponse -> Rep DeleteDBInstanceResponse x)
-> (forall x.
Rep DeleteDBInstanceResponse x -> DeleteDBInstanceResponse)
-> Generic DeleteDBInstanceResponse
forall x.
Rep DeleteDBInstanceResponse x -> DeleteDBInstanceResponse
forall x.
DeleteDBInstanceResponse -> Rep DeleteDBInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDBInstanceResponse x -> DeleteDBInstanceResponse
$cfrom :: forall x.
DeleteDBInstanceResponse -> Rep DeleteDBInstanceResponse x
Prelude.Generic)
newDeleteDBInstanceResponse ::
Prelude.Int ->
DeleteDBInstanceResponse
newDeleteDBInstanceResponse :: Int -> DeleteDBInstanceResponse
newDeleteDBInstanceResponse Int
pHttpStatus_ =
DeleteDBInstanceResponse' :: Maybe DBInstance -> Int -> DeleteDBInstanceResponse
DeleteDBInstanceResponse'
{ $sel:dbInstance:DeleteDBInstanceResponse' :: Maybe DBInstance
dbInstance =
Maybe DBInstance
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteDBInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteDBInstanceResponse_dbInstance :: Lens.Lens' DeleteDBInstanceResponse (Prelude.Maybe DBInstance)
deleteDBInstanceResponse_dbInstance :: (Maybe DBInstance -> f (Maybe DBInstance))
-> DeleteDBInstanceResponse -> f DeleteDBInstanceResponse
deleteDBInstanceResponse_dbInstance = (DeleteDBInstanceResponse -> Maybe DBInstance)
-> (DeleteDBInstanceResponse
-> Maybe DBInstance -> DeleteDBInstanceResponse)
-> Lens
DeleteDBInstanceResponse
DeleteDBInstanceResponse
(Maybe DBInstance)
(Maybe DBInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBInstanceResponse' {Maybe DBInstance
dbInstance :: Maybe DBInstance
$sel:dbInstance:DeleteDBInstanceResponse' :: DeleteDBInstanceResponse -> Maybe DBInstance
dbInstance} -> Maybe DBInstance
dbInstance) (\s :: DeleteDBInstanceResponse
s@DeleteDBInstanceResponse' {} Maybe DBInstance
a -> DeleteDBInstanceResponse
s {$sel:dbInstance:DeleteDBInstanceResponse' :: Maybe DBInstance
dbInstance = Maybe DBInstance
a} :: DeleteDBInstanceResponse)
deleteDBInstanceResponse_httpStatus :: Lens.Lens' DeleteDBInstanceResponse Prelude.Int
deleteDBInstanceResponse_httpStatus :: (Int -> f Int)
-> DeleteDBInstanceResponse -> f DeleteDBInstanceResponse
deleteDBInstanceResponse_httpStatus = (DeleteDBInstanceResponse -> Int)
-> (DeleteDBInstanceResponse -> Int -> DeleteDBInstanceResponse)
-> Lens DeleteDBInstanceResponse DeleteDBInstanceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDBInstanceResponse' :: DeleteDBInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteDBInstanceResponse
s@DeleteDBInstanceResponse' {} Int
a -> DeleteDBInstanceResponse
s {$sel:httpStatus:DeleteDBInstanceResponse' :: Int
httpStatus = Int
a} :: DeleteDBInstanceResponse)
instance Prelude.NFData DeleteDBInstanceResponse