{-# 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.DeleteDBClusterEndpoint
-- 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 custom endpoint and removes it from an Amazon Aurora DB
-- cluster.
--
-- This action only applies to Aurora DB clusters.
module Amazonka.RDS.DeleteDBClusterEndpoint
  ( -- * Creating a Request
    DeleteDBClusterEndpoint (..),
    newDeleteDBClusterEndpoint,

    -- * Request Lenses
    deleteDBClusterEndpoint_dbClusterEndpointIdentifier,

    -- * Destructuring the Response
    DBClusterEndpoint (..),
    newDBClusterEndpoint,

    -- * Response Lenses
    dbClusterEndpoint_customEndpointType,
    dbClusterEndpoint_dbClusterEndpointArn,
    dbClusterEndpoint_dbClusterEndpointIdentifier,
    dbClusterEndpoint_dbClusterEndpointResourceIdentifier,
    dbClusterEndpoint_dbClusterIdentifier,
    dbClusterEndpoint_endpoint,
    dbClusterEndpoint_endpointType,
    dbClusterEndpoint_excludedMembers,
    dbClusterEndpoint_staticMembers,
    dbClusterEndpoint_status,
  )
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:/ 'newDeleteDBClusterEndpoint' smart constructor.
data DeleteDBClusterEndpoint = DeleteDBClusterEndpoint'
  { -- | The identifier associated with the custom endpoint. This parameter is
    -- stored as a lowercase string.
    DeleteDBClusterEndpoint -> Text
dbClusterEndpointIdentifier :: Prelude.Text
  }
  deriving (DeleteDBClusterEndpoint -> DeleteDBClusterEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDBClusterEndpoint -> DeleteDBClusterEndpoint -> Bool
$c/= :: DeleteDBClusterEndpoint -> DeleteDBClusterEndpoint -> Bool
== :: DeleteDBClusterEndpoint -> DeleteDBClusterEndpoint -> Bool
$c== :: DeleteDBClusterEndpoint -> DeleteDBClusterEndpoint -> Bool
Prelude.Eq, ReadPrec [DeleteDBClusterEndpoint]
ReadPrec DeleteDBClusterEndpoint
Int -> ReadS DeleteDBClusterEndpoint
ReadS [DeleteDBClusterEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDBClusterEndpoint]
$creadListPrec :: ReadPrec [DeleteDBClusterEndpoint]
readPrec :: ReadPrec DeleteDBClusterEndpoint
$creadPrec :: ReadPrec DeleteDBClusterEndpoint
readList :: ReadS [DeleteDBClusterEndpoint]
$creadList :: ReadS [DeleteDBClusterEndpoint]
readsPrec :: Int -> ReadS DeleteDBClusterEndpoint
$creadsPrec :: Int -> ReadS DeleteDBClusterEndpoint
Prelude.Read, Int -> DeleteDBClusterEndpoint -> ShowS
[DeleteDBClusterEndpoint] -> ShowS
DeleteDBClusterEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDBClusterEndpoint] -> ShowS
$cshowList :: [DeleteDBClusterEndpoint] -> ShowS
show :: DeleteDBClusterEndpoint -> String
$cshow :: DeleteDBClusterEndpoint -> String
showsPrec :: Int -> DeleteDBClusterEndpoint -> ShowS
$cshowsPrec :: Int -> DeleteDBClusterEndpoint -> ShowS
Prelude.Show, forall x. Rep DeleteDBClusterEndpoint x -> DeleteDBClusterEndpoint
forall x. DeleteDBClusterEndpoint -> Rep DeleteDBClusterEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDBClusterEndpoint x -> DeleteDBClusterEndpoint
$cfrom :: forall x. DeleteDBClusterEndpoint -> Rep DeleteDBClusterEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDBClusterEndpoint' 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:
--
-- 'dbClusterEndpointIdentifier', 'deleteDBClusterEndpoint_dbClusterEndpointIdentifier' - The identifier associated with the custom endpoint. This parameter is
-- stored as a lowercase string.
newDeleteDBClusterEndpoint ::
  -- | 'dbClusterEndpointIdentifier'
  Prelude.Text ->
  DeleteDBClusterEndpoint
newDeleteDBClusterEndpoint :: Text -> DeleteDBClusterEndpoint
newDeleteDBClusterEndpoint
  Text
pDBClusterEndpointIdentifier_ =
    DeleteDBClusterEndpoint'
      { $sel:dbClusterEndpointIdentifier:DeleteDBClusterEndpoint' :: Text
dbClusterEndpointIdentifier =
          Text
pDBClusterEndpointIdentifier_
      }

-- | The identifier associated with the custom endpoint. This parameter is
-- stored as a lowercase string.
deleteDBClusterEndpoint_dbClusterEndpointIdentifier :: Lens.Lens' DeleteDBClusterEndpoint Prelude.Text
deleteDBClusterEndpoint_dbClusterEndpointIdentifier :: Lens' DeleteDBClusterEndpoint Text
deleteDBClusterEndpoint_dbClusterEndpointIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBClusterEndpoint' {Text
dbClusterEndpointIdentifier :: Text
$sel:dbClusterEndpointIdentifier:DeleteDBClusterEndpoint' :: DeleteDBClusterEndpoint -> Text
dbClusterEndpointIdentifier} -> Text
dbClusterEndpointIdentifier) (\s :: DeleteDBClusterEndpoint
s@DeleteDBClusterEndpoint' {} Text
a -> DeleteDBClusterEndpoint
s {$sel:dbClusterEndpointIdentifier:DeleteDBClusterEndpoint' :: Text
dbClusterEndpointIdentifier = Text
a} :: DeleteDBClusterEndpoint)

instance Core.AWSRequest DeleteDBClusterEndpoint where
  type
    AWSResponse DeleteDBClusterEndpoint =
      DBClusterEndpoint
  request :: (Service -> Service)
-> DeleteDBClusterEndpoint -> Request DeleteDBClusterEndpoint
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 DeleteDBClusterEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBClusterEndpoint)))
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
"DeleteDBClusterEndpointResult"
      (\Int
s ResponseHeaders
h [Node]
x -> forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)

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

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

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

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

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