{-# 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.Redshift.DeleteEndpointAccess
-- 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 Redshift-managed VPC endpoint.
module Amazonka.Redshift.DeleteEndpointAccess
  ( -- * Creating a Request
    DeleteEndpointAccess (..),
    newDeleteEndpointAccess,

    -- * Request Lenses
    deleteEndpointAccess_endpointName,

    -- * Destructuring the Response
    EndpointAccess (..),
    newEndpointAccess,

    -- * Response Lenses
    endpointAccess_endpointName,
    endpointAccess_endpointCreateTime,
    endpointAccess_subnetGroupName,
    endpointAccess_address,
    endpointAccess_clusterIdentifier,
    endpointAccess_endpointStatus,
    endpointAccess_vpcSecurityGroups,
    endpointAccess_resourceOwner,
    endpointAccess_vpcEndpoint,
    endpointAccess_port,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'DeleteEndpointAccess' 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:
--
-- 'endpointName', 'deleteEndpointAccess_endpointName' - The Redshift-managed VPC endpoint to delete.
newDeleteEndpointAccess ::
  -- | 'endpointName'
  Prelude.Text ->
  DeleteEndpointAccess
newDeleteEndpointAccess :: Text -> DeleteEndpointAccess
newDeleteEndpointAccess Text
pEndpointName_ =
  DeleteEndpointAccess' :: Text -> DeleteEndpointAccess
DeleteEndpointAccess'
    { $sel:endpointName:DeleteEndpointAccess' :: Text
endpointName =
        Text
pEndpointName_
    }

-- | The Redshift-managed VPC endpoint to delete.
deleteEndpointAccess_endpointName :: Lens.Lens' DeleteEndpointAccess Prelude.Text
deleteEndpointAccess_endpointName :: (Text -> f Text) -> DeleteEndpointAccess -> f DeleteEndpointAccess
deleteEndpointAccess_endpointName = (DeleteEndpointAccess -> Text)
-> (DeleteEndpointAccess -> Text -> DeleteEndpointAccess)
-> Lens DeleteEndpointAccess DeleteEndpointAccess Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEndpointAccess' {Text
endpointName :: Text
$sel:endpointName:DeleteEndpointAccess' :: DeleteEndpointAccess -> Text
endpointName} -> Text
endpointName) (\s :: DeleteEndpointAccess
s@DeleteEndpointAccess' {} Text
a -> DeleteEndpointAccess
s {$sel:endpointName:DeleteEndpointAccess' :: Text
endpointName = Text
a} :: DeleteEndpointAccess)

instance Core.AWSRequest DeleteEndpointAccess where
  type
    AWSResponse DeleteEndpointAccess =
      EndpointAccess
  request :: DeleteEndpointAccess -> Request DeleteEndpointAccess
request = Service -> DeleteEndpointAccess -> Request DeleteEndpointAccess
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEndpointAccess
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEndpointAccess)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteEndpointAccess))
-> Logger
-> Service
-> Proxy DeleteEndpointAccess
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEndpointAccess)))
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
"DeleteEndpointAccessResult"
      (\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String EndpointAccess
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)

instance Prelude.Hashable DeleteEndpointAccess

instance Prelude.NFData DeleteEndpointAccess

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

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

instance Core.ToQuery DeleteEndpointAccess where
  toQuery :: DeleteEndpointAccess -> QueryString
toQuery DeleteEndpointAccess' {Text
endpointName :: Text
$sel:endpointName:DeleteEndpointAccess' :: DeleteEndpointAccess -> 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
"DeleteEndpointAccess" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"EndpointName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
endpointName
      ]