{-# 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.DeleteDBProxyEndpoint
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a @DBProxyEndpoint@. Doing so removes the ability to access the
-- DB proxy using the endpoint that you defined. The endpoint that you
-- delete might have provided capabilities such as read\/write or read-only
-- operations, or using a different VPC than the DB proxy\'s default VPC.
module Amazonka.RDS.DeleteDBProxyEndpoint
  ( -- * Creating a Request
    DeleteDBProxyEndpoint (..),
    newDeleteDBProxyEndpoint,

    -- * Request Lenses
    deleteDBProxyEndpoint_dbProxyEndpointName,

    -- * Destructuring the Response
    DeleteDBProxyEndpointResponse (..),
    newDeleteDBProxyEndpointResponse,

    -- * Response Lenses
    deleteDBProxyEndpointResponse_dbProxyEndpoint,
    deleteDBProxyEndpointResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'DeleteDBProxyEndpoint' 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:
--
-- 'dbProxyEndpointName', 'deleteDBProxyEndpoint_dbProxyEndpointName' - The name of the DB proxy endpoint to delete.
newDeleteDBProxyEndpoint ::
  -- | 'dbProxyEndpointName'
  Prelude.Text ->
  DeleteDBProxyEndpoint
newDeleteDBProxyEndpoint :: Text -> DeleteDBProxyEndpoint
newDeleteDBProxyEndpoint Text
pDBProxyEndpointName_ =
  DeleteDBProxyEndpoint'
    { $sel:dbProxyEndpointName:DeleteDBProxyEndpoint' :: Text
dbProxyEndpointName =
        Text
pDBProxyEndpointName_
    }

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

instance Core.AWSRequest DeleteDBProxyEndpoint where
  type
    AWSResponse DeleteDBProxyEndpoint =
      DeleteDBProxyEndpointResponse
  request :: (Service -> Service)
-> DeleteDBProxyEndpoint -> Request DeleteDBProxyEndpoint
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteDBProxyEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBProxyEndpoint)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeleteDBProxyEndpointResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe DBProxyEndpoint -> Int -> DeleteDBProxyEndpointResponse
DeleteDBProxyEndpointResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DBProxyEndpoint")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteDBProxyEndpoint where
  hashWithSalt :: Int -> DeleteDBProxyEndpoint -> Int
hashWithSalt Int
_salt DeleteDBProxyEndpoint' {Text
dbProxyEndpointName :: Text
$sel:dbProxyEndpointName:DeleteDBProxyEndpoint' :: DeleteDBProxyEndpoint -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dbProxyEndpointName

instance Prelude.NFData DeleteDBProxyEndpoint where
  rnf :: DeleteDBProxyEndpoint -> ()
rnf DeleteDBProxyEndpoint' {Text
dbProxyEndpointName :: Text
$sel:dbProxyEndpointName:DeleteDBProxyEndpoint' :: DeleteDBProxyEndpoint -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
dbProxyEndpointName

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

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

instance Data.ToQuery DeleteDBProxyEndpoint where
  toQuery :: DeleteDBProxyEndpoint -> QueryString
toQuery DeleteDBProxyEndpoint' {Text
dbProxyEndpointName :: Text
$sel:dbProxyEndpointName:DeleteDBProxyEndpoint' :: DeleteDBProxyEndpoint -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeleteDBProxyEndpoint" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBProxyEndpointName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
dbProxyEndpointName
      ]

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

-- |
-- Create a value of 'DeleteDBProxyEndpointResponse' 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:
--
-- 'dbProxyEndpoint', 'deleteDBProxyEndpointResponse_dbProxyEndpoint' - The data structure representing the details of the DB proxy endpoint
-- that you delete.
--
-- 'httpStatus', 'deleteDBProxyEndpointResponse_httpStatus' - The response's http status code.
newDeleteDBProxyEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteDBProxyEndpointResponse
newDeleteDBProxyEndpointResponse :: Int -> DeleteDBProxyEndpointResponse
newDeleteDBProxyEndpointResponse Int
pHttpStatus_ =
  DeleteDBProxyEndpointResponse'
    { $sel:dbProxyEndpoint:DeleteDBProxyEndpointResponse' :: Maybe DBProxyEndpoint
dbProxyEndpoint =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteDBProxyEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The data structure representing the details of the DB proxy endpoint
-- that you delete.
deleteDBProxyEndpointResponse_dbProxyEndpoint :: Lens.Lens' DeleteDBProxyEndpointResponse (Prelude.Maybe DBProxyEndpoint)
deleteDBProxyEndpointResponse_dbProxyEndpoint :: Lens' DeleteDBProxyEndpointResponse (Maybe DBProxyEndpoint)
deleteDBProxyEndpointResponse_dbProxyEndpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBProxyEndpointResponse' {Maybe DBProxyEndpoint
dbProxyEndpoint :: Maybe DBProxyEndpoint
$sel:dbProxyEndpoint:DeleteDBProxyEndpointResponse' :: DeleteDBProxyEndpointResponse -> Maybe DBProxyEndpoint
dbProxyEndpoint} -> Maybe DBProxyEndpoint
dbProxyEndpoint) (\s :: DeleteDBProxyEndpointResponse
s@DeleteDBProxyEndpointResponse' {} Maybe DBProxyEndpoint
a -> DeleteDBProxyEndpointResponse
s {$sel:dbProxyEndpoint:DeleteDBProxyEndpointResponse' :: Maybe DBProxyEndpoint
dbProxyEndpoint = Maybe DBProxyEndpoint
a} :: DeleteDBProxyEndpointResponse)

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

instance Prelude.NFData DeleteDBProxyEndpointResponse where
  rnf :: DeleteDBProxyEndpointResponse -> ()
rnf DeleteDBProxyEndpointResponse' {Int
Maybe DBProxyEndpoint
httpStatus :: Int
dbProxyEndpoint :: Maybe DBProxyEndpoint
$sel:httpStatus:DeleteDBProxyEndpointResponse' :: DeleteDBProxyEndpointResponse -> Int
$sel:dbProxyEndpoint:DeleteDBProxyEndpointResponse' :: DeleteDBProxyEndpointResponse -> Maybe DBProxyEndpoint
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DBProxyEndpoint
dbProxyEndpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus