{-# 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-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 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_status,
    dbClusterEndpoint_dbClusterIdentifier,
    dbClusterEndpoint_dbClusterEndpointArn,
    dbClusterEndpoint_customEndpointType,
    dbClusterEndpoint_staticMembers,
    dbClusterEndpoint_endpointType,
    dbClusterEndpoint_dbClusterEndpointIdentifier,
    dbClusterEndpoint_endpoint,
    dbClusterEndpoint_dbClusterEndpointResourceIdentifier,
    dbClusterEndpoint_excludedMembers,
  )
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:/ '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
(DeleteDBClusterEndpoint -> DeleteDBClusterEndpoint -> Bool)
-> (DeleteDBClusterEndpoint -> DeleteDBClusterEndpoint -> Bool)
-> Eq DeleteDBClusterEndpoint
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]
(Int -> ReadS DeleteDBClusterEndpoint)
-> ReadS [DeleteDBClusterEndpoint]
-> ReadPrec DeleteDBClusterEndpoint
-> ReadPrec [DeleteDBClusterEndpoint]
-> Read 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
(Int -> DeleteDBClusterEndpoint -> ShowS)
-> (DeleteDBClusterEndpoint -> String)
-> ([DeleteDBClusterEndpoint] -> ShowS)
-> Show DeleteDBClusterEndpoint
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.
 DeleteDBClusterEndpoint -> Rep DeleteDBClusterEndpoint x)
-> (forall x.
    Rep DeleteDBClusterEndpoint x -> DeleteDBClusterEndpoint)
-> Generic DeleteDBClusterEndpoint
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' :: Text -> DeleteDBClusterEndpoint
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 :: (Text -> f Text)
-> DeleteDBClusterEndpoint -> f DeleteDBClusterEndpoint
deleteDBClusterEndpoint_dbClusterEndpointIdentifier = (DeleteDBClusterEndpoint -> Text)
-> (DeleteDBClusterEndpoint -> Text -> DeleteDBClusterEndpoint)
-> Lens DeleteDBClusterEndpoint DeleteDBClusterEndpoint Text Text
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 :: DeleteDBClusterEndpoint -> Request DeleteDBClusterEndpoint
request = Service
-> DeleteDBClusterEndpoint -> Request DeleteDBClusterEndpoint
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDBClusterEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBClusterEndpoint)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteDBClusterEndpoint))
-> Logger
-> Service
-> Proxy DeleteDBClusterEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBClusterEndpoint)))
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
"DeleteDBClusterEndpointResult"
      (\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String DBClusterEndpoint
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)

instance Prelude.Hashable DeleteDBClusterEndpoint

instance Prelude.NFData DeleteDBClusterEndpoint

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

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

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