{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.RDS.DeleteDBProxy
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an existing DB proxy.
module Amazonka.RDS.DeleteDBProxy
  ( -- * Creating a Request
    DeleteDBProxy (..),
    newDeleteDBProxy,

    -- * Request Lenses
    deleteDBProxy_dbProxyName,

    -- * Destructuring the Response
    DeleteDBProxyResponse (..),
    newDeleteDBProxyResponse,

    -- * Response Lenses
    deleteDBProxyResponse_dbProxy,
    deleteDBProxyResponse_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

-- | /See:/ 'newDeleteDBProxy' smart constructor.
data DeleteDBProxy = DeleteDBProxy'
  { -- | The name of the DB proxy to delete.
    DeleteDBProxy -> Text
dbProxyName :: Prelude.Text
  }
  deriving (DeleteDBProxy -> DeleteDBProxy -> Bool
(DeleteDBProxy -> DeleteDBProxy -> Bool)
-> (DeleteDBProxy -> DeleteDBProxy -> Bool) -> Eq DeleteDBProxy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDBProxy -> DeleteDBProxy -> Bool
$c/= :: DeleteDBProxy -> DeleteDBProxy -> Bool
== :: DeleteDBProxy -> DeleteDBProxy -> Bool
$c== :: DeleteDBProxy -> DeleteDBProxy -> Bool
Prelude.Eq, ReadPrec [DeleteDBProxy]
ReadPrec DeleteDBProxy
Int -> ReadS DeleteDBProxy
ReadS [DeleteDBProxy]
(Int -> ReadS DeleteDBProxy)
-> ReadS [DeleteDBProxy]
-> ReadPrec DeleteDBProxy
-> ReadPrec [DeleteDBProxy]
-> Read DeleteDBProxy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDBProxy]
$creadListPrec :: ReadPrec [DeleteDBProxy]
readPrec :: ReadPrec DeleteDBProxy
$creadPrec :: ReadPrec DeleteDBProxy
readList :: ReadS [DeleteDBProxy]
$creadList :: ReadS [DeleteDBProxy]
readsPrec :: Int -> ReadS DeleteDBProxy
$creadsPrec :: Int -> ReadS DeleteDBProxy
Prelude.Read, Int -> DeleteDBProxy -> ShowS
[DeleteDBProxy] -> ShowS
DeleteDBProxy -> String
(Int -> DeleteDBProxy -> ShowS)
-> (DeleteDBProxy -> String)
-> ([DeleteDBProxy] -> ShowS)
-> Show DeleteDBProxy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDBProxy] -> ShowS
$cshowList :: [DeleteDBProxy] -> ShowS
show :: DeleteDBProxy -> String
$cshow :: DeleteDBProxy -> String
showsPrec :: Int -> DeleteDBProxy -> ShowS
$cshowsPrec :: Int -> DeleteDBProxy -> ShowS
Prelude.Show, (forall x. DeleteDBProxy -> Rep DeleteDBProxy x)
-> (forall x. Rep DeleteDBProxy x -> DeleteDBProxy)
-> Generic DeleteDBProxy
forall x. Rep DeleteDBProxy x -> DeleteDBProxy
forall x. DeleteDBProxy -> Rep DeleteDBProxy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDBProxy x -> DeleteDBProxy
$cfrom :: forall x. DeleteDBProxy -> Rep DeleteDBProxy x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDBProxy' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'dbProxyName', 'deleteDBProxy_dbProxyName' - The name of the DB proxy to delete.
newDeleteDBProxy ::
  -- | 'dbProxyName'
  Prelude.Text ->
  DeleteDBProxy
newDeleteDBProxy :: Text -> DeleteDBProxy
newDeleteDBProxy Text
pDBProxyName_ =
  DeleteDBProxy' :: Text -> DeleteDBProxy
DeleteDBProxy' {$sel:dbProxyName:DeleteDBProxy' :: Text
dbProxyName = Text
pDBProxyName_}

-- | The name of the DB proxy to delete.
deleteDBProxy_dbProxyName :: Lens.Lens' DeleteDBProxy Prelude.Text
deleteDBProxy_dbProxyName :: (Text -> f Text) -> DeleteDBProxy -> f DeleteDBProxy
deleteDBProxy_dbProxyName = (DeleteDBProxy -> Text)
-> (DeleteDBProxy -> Text -> DeleteDBProxy)
-> Lens DeleteDBProxy DeleteDBProxy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBProxy' {Text
dbProxyName :: Text
$sel:dbProxyName:DeleteDBProxy' :: DeleteDBProxy -> Text
dbProxyName} -> Text
dbProxyName) (\s :: DeleteDBProxy
s@DeleteDBProxy' {} Text
a -> DeleteDBProxy
s {$sel:dbProxyName:DeleteDBProxy' :: Text
dbProxyName = Text
a} :: DeleteDBProxy)

instance Core.AWSRequest DeleteDBProxy where
  type
    AWSResponse DeleteDBProxy =
      DeleteDBProxyResponse
  request :: DeleteDBProxy -> Request DeleteDBProxy
request = Service -> DeleteDBProxy -> Request DeleteDBProxy
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDBProxy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDBProxy)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteDBProxy))
-> Logger
-> Service
-> Proxy DeleteDBProxy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDBProxy)))
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
"DeleteDBProxyResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe DBProxy -> Int -> DeleteDBProxyResponse
DeleteDBProxyResponse'
            (Maybe DBProxy -> Int -> DeleteDBProxyResponse)
-> Either String (Maybe DBProxy)
-> Either String (Int -> DeleteDBProxyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBProxy)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBProxy")
            Either String (Int -> DeleteDBProxyResponse)
-> Either String Int -> Either String DeleteDBProxyResponse
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 DeleteDBProxy

instance Prelude.NFData DeleteDBProxy

instance Core.ToHeaders DeleteDBProxy where
  toHeaders :: DeleteDBProxy -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteDBProxy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DeleteDBProxy where
  toPath :: DeleteDBProxy -> ByteString
toPath = ByteString -> DeleteDBProxy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DeleteDBProxy where
  toQuery :: DeleteDBProxy -> QueryString
toQuery DeleteDBProxy' {Text
dbProxyName :: Text
$sel:dbProxyName:DeleteDBProxy' :: DeleteDBProxy -> 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
"DeleteDBProxy" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBProxyName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbProxyName
      ]

-- | /See:/ 'newDeleteDBProxyResponse' smart constructor.
data DeleteDBProxyResponse = DeleteDBProxyResponse'
  { -- | The data structure representing the details of the DB proxy that you
    -- delete.
    DeleteDBProxyResponse -> Maybe DBProxy
dbProxy :: Prelude.Maybe DBProxy,
    -- | The response's http status code.
    DeleteDBProxyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteDBProxyResponse -> DeleteDBProxyResponse -> Bool
(DeleteDBProxyResponse -> DeleteDBProxyResponse -> Bool)
-> (DeleteDBProxyResponse -> DeleteDBProxyResponse -> Bool)
-> Eq DeleteDBProxyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDBProxyResponse -> DeleteDBProxyResponse -> Bool
$c/= :: DeleteDBProxyResponse -> DeleteDBProxyResponse -> Bool
== :: DeleteDBProxyResponse -> DeleteDBProxyResponse -> Bool
$c== :: DeleteDBProxyResponse -> DeleteDBProxyResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDBProxyResponse]
ReadPrec DeleteDBProxyResponse
Int -> ReadS DeleteDBProxyResponse
ReadS [DeleteDBProxyResponse]
(Int -> ReadS DeleteDBProxyResponse)
-> ReadS [DeleteDBProxyResponse]
-> ReadPrec DeleteDBProxyResponse
-> ReadPrec [DeleteDBProxyResponse]
-> Read DeleteDBProxyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDBProxyResponse]
$creadListPrec :: ReadPrec [DeleteDBProxyResponse]
readPrec :: ReadPrec DeleteDBProxyResponse
$creadPrec :: ReadPrec DeleteDBProxyResponse
readList :: ReadS [DeleteDBProxyResponse]
$creadList :: ReadS [DeleteDBProxyResponse]
readsPrec :: Int -> ReadS DeleteDBProxyResponse
$creadsPrec :: Int -> ReadS DeleteDBProxyResponse
Prelude.Read, Int -> DeleteDBProxyResponse -> ShowS
[DeleteDBProxyResponse] -> ShowS
DeleteDBProxyResponse -> String
(Int -> DeleteDBProxyResponse -> ShowS)
-> (DeleteDBProxyResponse -> String)
-> ([DeleteDBProxyResponse] -> ShowS)
-> Show DeleteDBProxyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDBProxyResponse] -> ShowS
$cshowList :: [DeleteDBProxyResponse] -> ShowS
show :: DeleteDBProxyResponse -> String
$cshow :: DeleteDBProxyResponse -> String
showsPrec :: Int -> DeleteDBProxyResponse -> ShowS
$cshowsPrec :: Int -> DeleteDBProxyResponse -> ShowS
Prelude.Show, (forall x. DeleteDBProxyResponse -> Rep DeleteDBProxyResponse x)
-> (forall x. Rep DeleteDBProxyResponse x -> DeleteDBProxyResponse)
-> Generic DeleteDBProxyResponse
forall x. Rep DeleteDBProxyResponse x -> DeleteDBProxyResponse
forall x. DeleteDBProxyResponse -> Rep DeleteDBProxyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDBProxyResponse x -> DeleteDBProxyResponse
$cfrom :: forall x. DeleteDBProxyResponse -> Rep DeleteDBProxyResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDBProxyResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'dbProxy', 'deleteDBProxyResponse_dbProxy' - The data structure representing the details of the DB proxy that you
-- delete.
--
-- 'httpStatus', 'deleteDBProxyResponse_httpStatus' - The response's http status code.
newDeleteDBProxyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteDBProxyResponse
newDeleteDBProxyResponse :: Int -> DeleteDBProxyResponse
newDeleteDBProxyResponse Int
pHttpStatus_ =
  DeleteDBProxyResponse' :: Maybe DBProxy -> Int -> DeleteDBProxyResponse
DeleteDBProxyResponse'
    { $sel:dbProxy:DeleteDBProxyResponse' :: Maybe DBProxy
dbProxy = Maybe DBProxy
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteDBProxyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The data structure representing the details of the DB proxy that you
-- delete.
deleteDBProxyResponse_dbProxy :: Lens.Lens' DeleteDBProxyResponse (Prelude.Maybe DBProxy)
deleteDBProxyResponse_dbProxy :: (Maybe DBProxy -> f (Maybe DBProxy))
-> DeleteDBProxyResponse -> f DeleteDBProxyResponse
deleteDBProxyResponse_dbProxy = (DeleteDBProxyResponse -> Maybe DBProxy)
-> (DeleteDBProxyResponse
    -> Maybe DBProxy -> DeleteDBProxyResponse)
-> Lens
     DeleteDBProxyResponse
     DeleteDBProxyResponse
     (Maybe DBProxy)
     (Maybe DBProxy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBProxyResponse' {Maybe DBProxy
dbProxy :: Maybe DBProxy
$sel:dbProxy:DeleteDBProxyResponse' :: DeleteDBProxyResponse -> Maybe DBProxy
dbProxy} -> Maybe DBProxy
dbProxy) (\s :: DeleteDBProxyResponse
s@DeleteDBProxyResponse' {} Maybe DBProxy
a -> DeleteDBProxyResponse
s {$sel:dbProxy:DeleteDBProxyResponse' :: Maybe DBProxy
dbProxy = Maybe DBProxy
a} :: DeleteDBProxyResponse)

-- | The response's http status code.
deleteDBProxyResponse_httpStatus :: Lens.Lens' DeleteDBProxyResponse Prelude.Int
deleteDBProxyResponse_httpStatus :: (Int -> f Int) -> DeleteDBProxyResponse -> f DeleteDBProxyResponse
deleteDBProxyResponse_httpStatus = (DeleteDBProxyResponse -> Int)
-> (DeleteDBProxyResponse -> Int -> DeleteDBProxyResponse)
-> Lens DeleteDBProxyResponse DeleteDBProxyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBProxyResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDBProxyResponse' :: DeleteDBProxyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteDBProxyResponse
s@DeleteDBProxyResponse' {} Int
a -> DeleteDBProxyResponse
s {$sel:httpStatus:DeleteDBProxyResponse' :: Int
httpStatus = Int
a} :: DeleteDBProxyResponse)

instance Prelude.NFData DeleteDBProxyResponse