{-# 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-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 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.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:/ 'newDeleteDBProxyEndpoint' smart constructor.
data DeleteDBProxyEndpoint = DeleteDBProxyEndpoint'
  { -- | The name of the DB proxy endpoint to delete.
    DeleteDBProxyEndpoint -> Text
dbProxyEndpointName :: Prelude.Text
  }
  deriving (DeleteDBProxyEndpoint -> DeleteDBProxyEndpoint -> Bool
(DeleteDBProxyEndpoint -> DeleteDBProxyEndpoint -> Bool)
-> (DeleteDBProxyEndpoint -> DeleteDBProxyEndpoint -> Bool)
-> Eq DeleteDBProxyEndpoint
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]
(Int -> ReadS DeleteDBProxyEndpoint)
-> ReadS [DeleteDBProxyEndpoint]
-> ReadPrec DeleteDBProxyEndpoint
-> ReadPrec [DeleteDBProxyEndpoint]
-> Read 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
(Int -> DeleteDBProxyEndpoint -> ShowS)
-> (DeleteDBProxyEndpoint -> String)
-> ([DeleteDBProxyEndpoint] -> ShowS)
-> Show DeleteDBProxyEndpoint
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. DeleteDBProxyEndpoint -> Rep DeleteDBProxyEndpoint x)
-> (forall x. Rep DeleteDBProxyEndpoint x -> DeleteDBProxyEndpoint)
-> Generic DeleteDBProxyEndpoint
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' :: Text -> DeleteDBProxyEndpoint
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 :: (Text -> f Text)
-> DeleteDBProxyEndpoint -> f DeleteDBProxyEndpoint
deleteDBProxyEndpoint_dbProxyEndpointName = (DeleteDBProxyEndpoint -> Text)
-> (DeleteDBProxyEndpoint -> Text -> DeleteDBProxyEndpoint)
-> Lens DeleteDBProxyEndpoint DeleteDBProxyEndpoint Text Text
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 :: DeleteDBProxyEndpoint -> Request DeleteDBProxyEndpoint
request = Service -> DeleteDBProxyEndpoint -> Request DeleteDBProxyEndpoint
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDBProxyEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBProxyEndpoint)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteDBProxyEndpoint))
-> Logger
-> Service
-> Proxy DeleteDBProxyEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBProxyEndpoint)))
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
"DeleteDBProxyEndpointResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe DBProxyEndpoint -> Int -> DeleteDBProxyEndpointResponse
DeleteDBProxyEndpointResponse'
            (Maybe DBProxyEndpoint -> Int -> DeleteDBProxyEndpointResponse)
-> Either String (Maybe DBProxyEndpoint)
-> Either String (Int -> DeleteDBProxyEndpointResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBProxyEndpoint)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBProxyEndpoint")
            Either String (Int -> DeleteDBProxyEndpointResponse)
-> Either String Int -> Either String DeleteDBProxyEndpointResponse
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 DeleteDBProxyEndpoint

instance Prelude.NFData DeleteDBProxyEndpoint

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

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

instance Core.ToQuery DeleteDBProxyEndpoint where
  toQuery :: DeleteDBProxyEndpoint -> QueryString
toQuery DeleteDBProxyEndpoint' {Text
dbProxyEndpointName :: Text
$sel:dbProxyEndpointName:DeleteDBProxyEndpoint' :: DeleteDBProxyEndpoint -> 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
"DeleteDBProxyEndpoint" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBProxyEndpointName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: 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
(DeleteDBProxyEndpointResponse
 -> DeleteDBProxyEndpointResponse -> Bool)
-> (DeleteDBProxyEndpointResponse
    -> DeleteDBProxyEndpointResponse -> Bool)
-> Eq DeleteDBProxyEndpointResponse
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]
(Int -> ReadS DeleteDBProxyEndpointResponse)
-> ReadS [DeleteDBProxyEndpointResponse]
-> ReadPrec DeleteDBProxyEndpointResponse
-> ReadPrec [DeleteDBProxyEndpointResponse]
-> Read 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
(Int -> DeleteDBProxyEndpointResponse -> ShowS)
-> (DeleteDBProxyEndpointResponse -> String)
-> ([DeleteDBProxyEndpointResponse] -> ShowS)
-> Show DeleteDBProxyEndpointResponse
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.
 DeleteDBProxyEndpointResponse
 -> Rep DeleteDBProxyEndpointResponse x)
-> (forall x.
    Rep DeleteDBProxyEndpointResponse x
    -> DeleteDBProxyEndpointResponse)
-> Generic DeleteDBProxyEndpointResponse
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' :: Maybe DBProxyEndpoint -> Int -> DeleteDBProxyEndpointResponse
DeleteDBProxyEndpointResponse'
    { $sel:dbProxyEndpoint:DeleteDBProxyEndpointResponse' :: Maybe DBProxyEndpoint
dbProxyEndpoint =
        Maybe 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 :: (Maybe DBProxyEndpoint -> f (Maybe DBProxyEndpoint))
-> DeleteDBProxyEndpointResponse -> f DeleteDBProxyEndpointResponse
deleteDBProxyEndpointResponse_dbProxyEndpoint = (DeleteDBProxyEndpointResponse -> Maybe DBProxyEndpoint)
-> (DeleteDBProxyEndpointResponse
    -> Maybe DBProxyEndpoint -> DeleteDBProxyEndpointResponse)
-> Lens
     DeleteDBProxyEndpointResponse
     DeleteDBProxyEndpointResponse
     (Maybe DBProxyEndpoint)
     (Maybe 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 :: (Int -> f Int)
-> DeleteDBProxyEndpointResponse -> f DeleteDBProxyEndpointResponse
deleteDBProxyEndpointResponse_httpStatus = (DeleteDBProxyEndpointResponse -> Int)
-> (DeleteDBProxyEndpointResponse
    -> Int -> DeleteDBProxyEndpointResponse)
-> Lens
     DeleteDBProxyEndpointResponse DeleteDBProxyEndpointResponse Int Int
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